Created
October 21, 2013 13:44
-
-
Save ryanand26/7084108 to your computer and use it in GitHub Desktop.
An async require.js declaration of Bing Maps, requires jQuery deferreds.
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
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