From 9344299298973c231b6ac53cba2970bcc66e8cf1 Mon Sep 17 00:00:00 2001 From: Rolf Sommerhalder Date: Sun, 18 May 2014 10:29:47 -0700 Subject: [PATCH] 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 --- src/_umd_header.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_umd_header.js b/src/_umd_header.js index cf27df7..70ac706 100644 --- a/src/_umd_header.js +++ b/src/_umd_header.js @@ -1,6 +1,8 @@ (function (root, factory) { 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') { module.exports = factory(require('d3'), require('topojson')); } else {