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
13 lines
451 B
JavaScript
13 lines
451 B
JavaScript
(function (root, factory) {
|
|
if (typeof define === 'function' && define.amd) {
|
|
define(['d3', 'topojson'], function(d3, topojson) {
|
|
return (root.planetaryjs = factory(d3, topojson, root));
|
|
});
|
|
} else if (typeof exports === 'object') {
|
|
module.exports = factory(require('d3'), require('topojson'));
|
|
} else {
|
|
root.planetaryjs = factory(root.d3, root.topojson, root);
|
|
}
|
|
}(this, function(d3, topojson, window) {
|
|
'use strict';
|