From cd1098a76b99017905eefed30c3e0276cfaae9ef Mon Sep 17 00:00:00 2001 From: Steven Stark Date: Tue, 7 Jul 2015 17:08:52 -0700 Subject: [PATCH] Support for CommonJS --- taggedInfiniteScroll.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/taggedInfiniteScroll.js b/taggedInfiniteScroll.js index e78b51c..44e32bd 100644 --- a/taggedInfiniteScroll.js +++ b/taggedInfiniteScroll.js @@ -3,11 +3,14 @@ if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['angular'], factory); + } else if (typeof exports === 'object') { + // CommonJS + factory(exports, require('angular')); } else { // Browser globals - root.taggedInfiniteScroll = factory(root.angular); + factory((root.taggedInfiniteScroll = {}), root.angular); } -}(this, function (angular) { +}(this, function (exports, angular) { "use strict"; // Allows a container to support infinite scroll @@ -62,5 +65,7 @@ // Just return a value to define the module export. // This example returns an object, but the module // can return a function as the exported value. - return module; + + exports.module = module; + return exports; }));