Skip to content

Commit

Permalink
Merge pull request #312 from kentcdodds/patch-2
Browse files Browse the repository at this point in the history
UMDifying js-data-angular
  • Loading branch information
jmdobry committed Mar 5, 2015
2 parents e14cbda + 5559e33 commit 2176abd
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*jshint loopfunc:true*/
(function (window, angular, undefined) {
(function (root, factory) {
'use strict';

var JSData;

try {
JSData = require('js-data');
} catch (e) {

}

if (!JSData) {
JSData = window.JSData;
if (typeof define === 'function' && define.amd) {
define(['angular', 'js-data'], function(angular, JSData) {
return factory(root, angular, JSData, undefined);
});
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = factory(root, require('angular') || root.angular, require('js-data'), undefined);
} else {
root.jsDataAngularModuleName = factory(root, root.angular, root.JSData, undefined);
}
}(this, function(window, angular, JSData, undefined) {
'use strict';

if (!JSData) {
throw new Error('js-data must be loaded!');
if (!JSData || !angular) {
throw new Error('js-data and angular must be loaded!');
}

var DSUtils = JSData.DSUtils;
Expand Down Expand Up @@ -502,5 +502,8 @@
DS.registerAdapter('http', DSHttpAdapter, { default: true });
}]);
}

// return the module name
return 'js-data';

})(window, window.angular);
});

0 comments on commit 2176abd

Please sign in to comment.