From 20bc0b3088850d235e434124cf68bf7a6ff6cb47 Mon Sep 17 00:00:00 2001 From: Michael Liu Date: Tue, 30 Dec 2014 13:24:08 -0800 Subject: [PATCH 1/2] convert mixin to UMD package --- lib/flight-with-child-components.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/flight-with-child-components.js b/lib/flight-with-child-components.js index 148142d..f4ba655 100644 --- a/lib/flight-with-child-components.js +++ b/lib/flight-with-child-components.js @@ -3,8 +3,23 @@ * * See the README.md for up-to-date docs. */ -define(function () { - 'use strict'; +'use strict'; + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([], function () { + return (root.returnExportsGlobal = factory()); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like enviroments that support module.exports, + // like Node. + module.exports = factory(); + } else { + factory(); + } +}(this, function () { var teardownEventCount = 0; @@ -76,4 +91,5 @@ define(function () { withChildComponents.withBoundLifecycle = withBoundLifecycle; return withChildComponents; -}); + +})); From 5497d1ef9173852bfa4c89986d3e80f50142ca6c Mon Sep 17 00:00:00 2001 From: Michael Liu Date: Tue, 30 Dec 2014 14:28:28 -0800 Subject: [PATCH 2/2] add entry point for npm --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 96d28c2..89824f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "flight-with-child-components", "version": "0.2.3", + "main": "lib/flight-with-child-components.js", "devDependencies": { "bower": "^1.3.3", "grunt": "~0.4.1",