Set planetaryjs global when using AMD

While using RequireJS to AMD load ng-planetaryjs, planetaryjs, and their
dependencies, ng-planetaryjs still looks for global object planetaryjs
(such as in `var globe = planetaryjs.planet();`). Thus use the UMD
pattern "AMD with global, Node, or global" instead of "AMD, Node, or
browser global" from https://sublime.wbond.net/packages/UMD%20snippets
This commit is contained in:
Rolf Sommerhalder 2014-05-18 10:29:47 -07:00 committed by Brandon Tilley
parent 3d6ca445f8
commit 9344299298

View File

@ -1,6 +1,8 @@
(function (root, factory) { (function (root, factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['d3', 'topojson'], factory); define(['d3', 'topojson'], function(d3, topojson) {
return (root.planetaryjs = factory(d3, topojson, root));
});
} else if (typeof exports === 'object') { } else if (typeof exports === 'object') {
module.exports = factory(require('d3'), require('topojson')); module.exports = factory(require('d3'), require('topojson'));
} else { } else {