Skip to content

Commit c4a65d3

Browse files
committed
Merge pull request scotttrinh#34 from Gotusso/requirejs-support
feat: Script loading for require.js Fixes scotttrinh#26
2 parents 24bb0ee + 56647fd commit c4a65d3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/angular-localForage.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
(function(window, angular, localforage, undefined) {
1+
(function(root, factory) {
2+
'use strict';
3+
4+
if(typeof define === 'function' && define.amd) { // AMD
5+
define(['localforage'], function(localforage) {
6+
factory(root.angular, localforage);
7+
});
8+
} else if(typeof exports === 'object') {
9+
module.exports = factory(root.angular, require('localforage')); // Node
10+
} else {
11+
factory(root.angular, root.localforage); // Browser
12+
}
13+
})(this, function(angular, localforage, undefined) {
214
'use strict';
315

416
var angularLocalForage = angular.module('LocalForageModule', ['ng']);
@@ -418,4 +430,5 @@
418430
}
419431
}
420432
}]);
421-
})(window, window.angular, window.localforage);
433+
});
434+

0 commit comments

Comments
 (0)