Callback when Map, Library and all dependencies are rendered RRS feed

  • Question

  • Hi,

    I am wondering if there is a call back when Bing has fully rendered the map and all it's dependencies.


    Thursday, November 20, 2014 8:24 PM


  • Do you want a callback for when the map code is done downloading, or when the map and all the map tiles for the current view have finished loading. If it is the first one you could create a simple function that waits until the Microsoft.Maps.Map namespace is available. Here is a code block as an example:

    function WaitForMapControl(callback){
    	var loaded = typeof(Microsoft) != 'undefined'
    		&& typeof(Microsoft.Maps) != 'undefined'
    		&& typeof(Microsoft.Maps.Map) != 'undefined';
    		setTimeout('WaitForMapControl', 100);
    	}else if(callback){
    window.onload = function(){
    		//Load map

    If it is the second one, there is a map event called tiledownloadcomplete which is fired once all the tiles have finished downloading which you could use. That said, you can make calls against the map as soon as you make the call to load it, there is no reason to wait.

    Friday, November 21, 2014 11:42 AM