Skip to content

Instantly share code, notes, and snippets.

@ca0v

ca0v/async.js

Created Nov 13, 2013
Embed
What would you like to do?
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