Declaration

Parameters

options

MapKit JS initialization options.

Discussion

Once you have created a JWT according to the guidelines in Creating and Using Tokens with MapKit JS, you are ready to begin using MapKit JS. The first step is to initialize the mapkit object with a token. To do this, set authorizationCallback to a function that obtains a token and passes it to the done() function.

If you have created a server endpoint to deliver new tokens to MapKit JS, make an asynchronous request to this endpoint in your authorizationCallback function and call done() with the result.

It is safe to call mapkit.init before the content of your page has fully loaded; in other words, before the window.load event fires. A mapkit object dispatches a configuration-change event once it has been initialized, and an error event when initialization fails. You can learn more about both of these events in Handling Initialization Events.