Created
November 13, 2013 15:14
-
-
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});
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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