Module Loading Methods

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

The following methods allow you to register and load your own modules for use by the map control. Al of these static methods are under the Microsoft.Maps namespace.

Name Description
loadModule(moduleKey: string or string[], options?: ModuleOptions or function()) Loads the specified registered module, making its functionality available. You can provide the name of a single module or an array of names in. Options or a callback function that is called when the module is loaded can be specified.

To register a custom module, use the registerModule method before calling the loadModule method.
moduleLoaded(moduleKey: string) Signals that the specified module has been loaded and if specified, calls the callback function in loadModule. Call this method at the end of your custom module script.
registerModule(moduleKey:string, scriptURL:string, options:{styleURLs:string[]}) Registers a module with the map control. The name of the module is specified in moduleKey, the module script is defined in scriptURL, and the options provides the location of a *.css file to load with the module.

Tip: To minimize possible conflicts with other custom modules, choose a unique module name (defined in moduleKey). For example, you can use your company name in the name of the module.

Once you have registered a module, you can make its functionality available by loading it using loadModule.