Skip to content

Instantly share code, notes, and snippets.

@ca0v
Created November 13, 2013 15:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ca0v/7450696 to your computer and use it in GitHub Desktop.
Save ca0v/7450696 to your computer and use it in GitHub Desktop.
async plugin specifically for google maps. example: require(["plugins/async!http://maps.google.com/maps/api/js?v=3&sensor=false"], function () {// can use google.maps now});
/**
* Dojo AMD Google Maps Loader Plugin
*/
define([
"dojo/_base/kernel",
"dojo/topic"
], function (kernel, topic) {
var w = kernel.global;
var cb ="_googleApiLoadCallback";
return {
load: function (param, req, loadCallback) {
if (!cb) return;
w[cb] = function () {
delete w[cb];
cb = null;
loadCallback();
}
require([param + "&callback=" + cb]);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment