Skip to content

Commit

Permalink
Merge pull request hpneo#413 from LightmakerCanada/amd
Browse files Browse the repository at this point in the history
Updated AMD config to enable async loading with `googlemaps-amd` plugin
  • Loading branch information
hpneo committed May 19, 2015
2 parents 2c24b34 + 03b2b6e commit e6cb4f3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
6 changes: 4 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ module.exports = function(grunt) {
all : {
src : 'gmaps.js',
objectToExport : 'GMaps',
amdModuleId : 'GMaps',
globalAlias : 'GMaps',
template : 'umd.hbs'
template : 'umd.hbs',
deps: {
amd: ['jquery', 'googlemaps!']
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions gmaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
module.exports = factory();
}
else if(typeof define === 'function' && define.amd) {
define('GMaps', [], factory);
define(['jquery', 'googlemaps!'], factory);
}
else {
root.GMaps = factory();
}

root.GMaps = factory();

}(this, function() {

Expand Down Expand Up @@ -2199,6 +2201,6 @@ if (!Array.prototype.indexOf) {
return -1;
}
}

return GMaps;
}));
2 changes: 1 addition & 1 deletion gmaps.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gmaps.min.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions umd.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
else if(typeof define === 'function' && define.amd) {
define({{#if amdModuleId}}'{{amdModuleId}}', {{/if}}[{{{amdDependencies}}}], factory);
}
else {
root.{{globalAlias}} = factory({{{globalDependencies}}});
}

root.{{globalAlias}} = factory({{{globalDependencies}}});

}(this, function({{dependencies}}) {

{{{code}}}

return {{objectToExport}};
}));

0 comments on commit e6cb4f3

Please sign in to comment.