MapManager class exposes a stream property that you can listen for any map-related events. A map event is an instance of MapManagerMessage, with various constructors for each specific event.
Supported Events
Example of all currently supported events:Be wary of race conditions when listening for
MapManagerMessageMapIsReady events. See Map Readiness for more information.dispose() method:
Map Readiness
TheMapManagerMessageMapIsReady constructor notifies the map is ready to be interacted with. This is an important event, because calling most methods in the MapManager class will cause an exception if the map is not ready.
We’ve built a helper async method you can use to easily verify or wait for the map to be ready:
Style Loaded
After the map is initially loaded, the default style provided in theTomTomMap’s widget options will be loaded and a MapManagerMessageOnStyleLoad event will be emitted. Additional style loaded events will be emitted when changing the map style mode or container.
In a similar manner to map readiness events, it is important to wait for the style to be loaded before calling methods applicable to the style. For example, calling mapManager.showLayer('layerName') while the style is loading will fail.