Skip to content

Commit

Permalink
Add UMD Support
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Weiland committed Dec 8, 2014
1 parent edbac62 commit 8df9a7b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions ngStorage.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
(function() {
(function(angular, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define('ngStore', ['angular'], function(angular) {
return factory(angular);
});
} else {
return factory(angular);
}
}(typeof angular === 'undefined' ? null : angular, function(angular) {

'use strict';

/**
* @ngdoc overview
* @name ngStorage
*/

angular.module('ngStorage', []).
angular.module('ngStorage', [])

/**
* @ngdoc object
Expand All @@ -15,7 +25,7 @@
* @requires $window
*/

factory('$localStorage', _storageFactory('localStorage')).
.factory('$localStorage', _storageFactory('localStorage'))

/**
* @ngdoc object
Expand All @@ -24,7 +34,7 @@
* @requires $window
*/

factory('$sessionStorage', _storageFactory('sessionStorage'));
.factory('$sessionStorage', _storageFactory('sessionStorage'));

function _storageFactory(storageType) {
return [
Expand Down Expand Up @@ -111,4 +121,4 @@
];
}

})();
}));

0 comments on commit 8df9a7b

Please sign in to comment.