Instance Method

addEventListener

Adds an event listener to handle events triggered by user interactions and the framework.

Declaration

void addEventListener(String type, function listener, optional Object thisObject);

Parameters

type

The event type of interest (e.g., "select").

listener

The callback function to invoke. Listener is passed a mapkit.Map event as its sole argument.

thisObject

An object to be set as the this keyword on the listener function.

Return Value

This method does not return a value.

Discussion

Adds listener as a callback for an event of type type. Throws an error if type is invalid. See Handling Map Events for a list of event types.

The following is an example of adding an event listener for a region change:

map.addEventListener("region-change-start", function(event) {
    console.log("Region Change Started");
});

See Also

Handling Map Events

Handling Map Events

Handle events triggered by user interactions and the framework.

removeEventListener

Removes an event listener.