Skip to content

Instantly share code, notes, and snippets.

@ryanand26
Created October 21, 2013 13:44
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 ryanand26/7084108 to your computer and use it in GitHub Desktop.
Save ryanand26/7084108 to your computer and use it in GitHub Desktop.
An async require.js declaration of Bing Maps, requires jQuery deferreds.
define('bingMaps',['async!//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0!OnScriptLoad'], function() {
var mapReadyDfd = $.Deferred(),
mapReadyTest = function () {
if (window.Microsoft && window.Microsoft.Maps && window.Microsoft.Maps.Location) {
mapReadyDfd.resolve(window.Microsoft.Maps);
}
else {
setTimeout(mapReadyTest, 100);
}
};
mapReadyTest();
return mapReadyDfd.promise();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment