Map loading question RRS feed

  • Question

  • We have custom classes that extend built-ins (eg custom layer, infobox, etc). For the purpose of simplicity lets say these classes are all contained in a single js file (extensions.js). Now that v8 forces asynchronous loading of the map library, we cannot load this file until the map control itself has finished loading, otherwise the base classes will not be defined. Luckily we have jQuery to help dynamically include js files at runtime.

    Now imagine our application also uses modules A, B, and C.

    To load our application, we have this nightmare:

    function __loadcore() {
      $.getScript("extensions.js", function() {
        Microsoft.Maps.loadModule("A", function() {
          Microsoft.Maps.loadModule("B", function() {
            Microsoft.Maps.loadModule("C", function() {
              // finally we can initialize our application

    Please tell me there is AT LEAST one of these possibilities:

    1. use synchronous (YES, BLOCKING) loading of the base map control
    2. include desired modules in the base map control script url (eg "&modules=[A,B,C]")
    3. load multiple modules in a single call
    4. force extensions.js to load after the map control without the use of $.getScript.


    • Edited by Posef Monday, June 5, 2017 7:53 PM
    Monday, June 5, 2017 7:49 PM