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