Map event listener manager. For details about how to obtain the map controller class, please refer to MapComponentController.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Example:
let mapEventManager: map.MapEventManager = this.mapController.getEventManager();
on(type: 'cameraChange', callback: Callback<mapCommon.LatLng>): void
Listens for map camera status changes. This API can use multiple asynchronous callbacks to return the result. The callback is not triggered during animation. Instead, it is triggered when the animation ends.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraChange': map camera status change event. |
| callback | Callback<mapCommon.LatLng> | Yes | Callback function, which returns mapCommon.LatLng. This callback listens for map camera status change events. The callback is not triggered during animation. Instead, it is triggered when the animation ends. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("cameraChange", `callback1 position = ${position.longitude}`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("cameraChange", `callback2 position = ${position.longitude}`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("cameraChange", `callback3 position = ${position.longitude}`);
};
mapEventManager.on("cameraChange", callback1);
mapEventManager.on("cameraChange", callback2);
mapEventManager.on("cameraChange", callback3); off(type: 'cameraChange', callback?: Callback<mapCommon.LatLng>): void
Cancels listening for map camera status changes. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraChange': map camera status change event. |
| callback | Callback<mapCommon.LatLng> | No | Callback function, which returns mapCommon.LatLng. This callback cancels listening for map camera status change events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("cameraChange", `callback1 position`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("cameraChange", `callback2 position`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("cameraChange", `callback3 position`);
};
mapEventManager.on("cameraChange", callback1);
mapEventManager.on("cameraChange", callback2);
mapEventManager.on("cameraChange", callback3);
// Cancel only the event response of the callback1 object. When a cameraChange event occurs, callback2 and callback3 will be called.
mapEventManager.off('cameraChange', callback1);
// Cancel all cameraChange event responses.
mapEventManager.off('cameraChange'); on(type: 'cameraIdle', callback: Callback<void>): void
Listens for camera movement end events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraIdle': camera movement end event. |
| callback | Callback<void> | Yes | Callback function that returns no result. This callback listens for camera movement end events. |
Example:
let callback1 = () => {
console.info("cameraIdle", `callback1`);
};
let callback2 = () => {
console.info("cameraIdle", `callback2`);
};
let callback3 = () => {
console.info("cameraIdle", `callback3`);
};
mapEventManager.on("cameraIdle", callback1);
mapEventManager.on("cameraIdle", callback2);
mapEventManager.on("cameraIdle", callback3); off(type: 'cameraIdle', callback?: Callback<void>): void
Cancels listening for camera movement end events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraIdle': camera movement end event. |
| callback | Callback<void> | No | Callback function that returns no result. This callback cancels listening for camera movement end events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = () => {
console.info("cameraIdle", `callback1`);
};
let callback2 = () => {
console.info("cameraIdle", `callback2`);
};
let callback3 = () => {
console.info("cameraIdle", `callback3`);
};
mapEventManager.on("cameraIdle", callback1);
mapEventManager.on("cameraIdle", callback2);
mapEventManager.on("cameraIdle", callback3);
// Cancel only the event response of the callback1 object. When a cameraIdle event occurs, callback2 and callback3 will be called.
mapEventManager.off('cameraIdle', callback1);
// Cancel all cameraIdle event responses.
mapEventManager.off('cameraIdle'); on(type: 'cameraMoveCancel', callback: Callback<void>): void
Listens for camera movement cancellation events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraMoveCancel': camera movement cancellation event. |
| callback | Callback<void> | Yes | Callback function that returns no result. This callback listens for map camera movement cancellation events. |
Example:
let callback1 = () => {
console.info("cameraMoveCancel", `callback1`);
};
let callback2 = () => {
console.info("cameraMoveCancel", `callback2`);
};
let callback3 = () => {
console.info("cameraMoveCancel", `callback3`);
};
mapEventManager.on("cameraMoveCancel", callback1);
mapEventManager.on("cameraMoveCancel", callback2);
mapEventManager.on("cameraMoveCancel", callback3); off(type: 'cameraMoveCancel', callback?: Callback<void>): void
Cancels listening for camera movement cancellation events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraMoveCancel': camera movement cancellation event. |
| callback | Callback<void> | No | Callback function that returns no result. This callback cancels listening for camera movement cancellation events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = () => {
console.info("cameraMoveCancel", `callback1`);
};
let callback2 = () => {
console.info("cameraMoveCancel", `callback2`);
};
let callback3 = () => {
console.info("cameraMoveCancel", `callback3`);
};
mapEventManager.on("cameraMoveCancel", callback1);
mapEventManager.on("cameraMoveCancel", callback2);
mapEventManager.on("cameraMoveCancel", callback3);
// Cancel only the event response of the callback1 object. When a cameraMoveCancel event occurs, callback2 and callback3 will be called.
mapEventManager.off('cameraMoveCancel', callback1);
// Cancel all cameraMoveCancel event responses.
mapEventManager.off('cameraMoveCancel'); on(type: 'cameraMove', callback: Callback<void>): void
Listens for camera movement events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraMove': camera movement event. |
| callback | Callback<void> | Yes | Callback function that returns no result. This callback listens for camera movement events. |
Example:
let callback1 = () => {
console.info("cameraMove", `callback1`);
};
let callback2 = () => {
console.info("cameraMove", `callback2`);
};
let callback3 = () => {
console.info("cameraMove", `callback3`);
};
mapEventManager.on("cameraMove", callback1);
mapEventManager.on("cameraMove", callback2);
mapEventManager.on("cameraMove", callback3); off(type: 'cameraMove', callback?: Callback<void>): void
Cancels listening for camera movement events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraMove': camera movement event. |
| callback | Callback<void> | No | Callback function that returns no result. This callback cancels listening for camera movement events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = () => {
console.info("cameraMove", `callback1`);
};
let callback2 = () => {
console.info("cameraMove", `callback2`);
};
let callback3 = () => {
console.info("cameraMove", `callback3`);
};
mapEventManager.on("cameraMove", callback1);
mapEventManager.on("cameraMove", callback2);
mapEventManager.on("cameraMove", callback3);
// Cancel only the event response of the callback1 object. When a cameraMove event occurs, callback2 and callback3 will be called.
mapEventManager.off('cameraMove', callback1);
// Cancel all cameraMove event responses.
mapEventManager.off('cameraMove'); on(type: 'cameraMoveStart', callback: Callback<number>): void
Listens for camera movement start events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraMoveStart': camera movement start event. |
| callback | Callback<number> | Yes | Callback function used to listening for camera movement start events. This callback returns number. number indicates the reason why the camera moves. 1: A user makes a gesture on the map. 2: The default animation is triggered by user interaction. 3: You start an animation. |
Example:
let callback1 = (reason: number) => {
console.info("cameraMoveStart", `callback1 reason = ${reason}`);
};
let callback2 = (reason: number) => {
console.info("cameraMoveStart", `callback2 reason = ${reason}`);
};
let callback3 = (reason: number) => {
console.info("cameraMoveStart", `callback3 reason = ${reason}`);
};
mapEventManager.on("cameraMoveStart", callback1);
mapEventManager.on("cameraMoveStart", callback2);
mapEventManager.on("cameraMoveStart", callback3); off(type: 'cameraMoveStart', callback?: Callback<number>): void
Cancels listening for camera movement start events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'cameraMoveStart': camera movement start event. |
| callback | Callback<number> | No | Callback used to cancel listening for camera movement start events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. number indicates the reason why the camera moves. 1: A user makes a gesture on the map. 2: The default animation is triggered by user interaction. 3: You start an animation. |
Example:
let callback1 = (reason: number) => {
console.info("cameraMoveStart", `callback1`);
};
let callback2 = (reason: number) => {
console.info("cameraMoveStart", `callback2`);
};
let callback3 = (reason: number) => {
console.info("cameraMoveStart", `callback3`);
};
mapEventManager.on("cameraMoveStart", callback1);
mapEventManager.on("cameraMoveStart", callback2);
mapEventManager.on("cameraMoveStart", callback3);
// Cancel only the event response of the callback1 object. When a cameraMoveStart event occurs, callback2 and callback3 will be called.
mapEventManager.off('cameraMoveStart', callback1);
// Cancel all cameraMoveStart event responses.
mapEventManager.off('cameraMoveStart'); on(type: 'mapClick', callback: Callback<mapCommon.LatLng>): void
Listens for map tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'mapClick': map tap event. |
| callback | Callback<mapCommon.LatLng> | Yes | Callback function, which returns mapCommon.LatLng. This callback listens for map tap events. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("mapClick", `callback1 position = ${position.longitude}`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("mapClick", `callback2 position = ${position.longitude}`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("mapClick", `callback3 position = ${position.longitude}`);
};
mapEventManager.on("mapClick", callback1);
mapEventManager.on("mapClick", callback2);
mapEventManager.on("mapClick", callback3); off(type: 'mapClick', callback?: Callback<mapCommon.LatLng>): void
Cancels listening for map tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'mapClick': map tap event. |
| callback | Callback<mapCommon.LatLng> | No | Callback function, which returns mapCommon.LatLng. This callback cancels listening for map tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("mapClick", `callback1 position`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("mapClick", `callback2 position`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("mapClick", `callback3 position`);
};
mapEventManager.on("mapClick", callback1);
mapEventManager.on("mapClick", callback2);
mapEventManager.on("mapClick", callback3);
// Cancel only the event response of the callback1 object. When a mapClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('mapClick', callback1);
// Cancel all mapClick event responses.
mapEventManager.off('mapClick'); on(type: 'mapLoad', callback: Callback<void>): void
Listens for map load events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'mapLoad': map load event. |
| callback | Callback<void> | Yes | Callback function that returns no result. This callback listens for map load events. |
Example:
let callback1 = () => {
console.info("mapLoad", `callback1`);
};
let callback2 = () => {
console.info("mapLoad", `callback2`);
};
let callback3 = () => {
console.info("mapLoad", `callback3`);
};
mapEventManager.on("mapLoad", callback1);
mapEventManager.on("mapLoad", callback2);
mapEventManager.on("mapLoad", callback3); off(type: 'mapLoad', callback?: Callback<void>): void
Cancels listening for map load events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'mapLoad': map load event. |
| callback | Callback<void> | No | Callback function that returns no result. This callback cancels listening for map load events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = () => {
console.info("mapLoad", `callback1`);
};
let callback2 = () => {
console.info("mapLoad", `callback2`);
};
let callback3 = () => {
console.info("mapLoad", `callback3`);
};
mapEventManager.on("mapLoad", callback1);
mapEventManager.on("mapLoad", callback2);
mapEventManager.on("mapLoad", callback3);
// Cancel only the event response of the callback1 object. When a mapLoad event occurs, callback2 and callback3 will be called.
mapEventManager.off('mapLoad', callback1);
// Cancel all mapLoad event responses.
mapEventManager.off('mapLoad'); on(type: 'mapLongClick', callback: Callback<mapCommon.LatLng>): void
Listens for map long-press events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'mapLongClick': map long-press event. |
| callback | Callback<mapCommon.LatLng> | Yes | Callback function, which returns mapCommon.LatLng. This callback listens for map long-press events. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("mapLongClick", `callback1 position = ${position.longitude}`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("mapLongClick", `callback2 position = ${position.longitude}`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("mapLongClick", `callback3 position = ${position.longitude}`);
};
mapEventManager.on("mapLongClick", callback1);
mapEventManager.on("mapLongClick", callback2);
mapEventManager.on("mapLongClick", callback3); off(type: 'mapLongClick', callback?: Callback<mapCommon.LatLng>): void
Cancels listening for map long-press events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'mapLongClick': map long-press event. |
| callback | Callback<mapCommon.LatLng> | No | Callback function, which returns mapCommon.LatLng. This callback cancels listening for map long-press events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("mapLongClick", `callback1 position`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("mapLongClick", `callback2 position`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("mapLongClick", `callback3 position`);
};
mapEventManager.on("mapLongClick", callback1);
mapEventManager.on("mapLongClick", callback2);
mapEventManager.on("mapLongClick", callback3);
// Cancel only the event response of the callback1 object. When a mapLongClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('mapLongClick', callback1);
// Cancel all mapLongClick event responses.
mapEventManager.off('mapLongClick'); on(type: 'myLocationButtonClick', callback: Callback<void>): void
Listens for my-location icon tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'myLocationButtonClick': my-location icon tap event. |
| callback | Callback<void> | Yes | Callback function that returns no result. This callback listens for my-location icon tap events. |
Example:
let callback1 = () => {
console.info("myLocationButtonClick", `callback1`);
};
let callback2 = () => {
console.info("myLocationButtonClick", `callback2`);
};
let callback3 = () => {
console.info("myLocationButtonClick", `callback3`);
};
mapEventManager.on("myLocationButtonClick", callback1);
mapEventManager.on("myLocationButtonClick", callback2);
mapEventManager.on("myLocationButtonClick", callback3); off(type: 'myLocationButtonClick', callback?: Callback<void>): void
Cancels listening for my-location icon tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'myLocationButtonClick': my-location icon tap event. |
| callback | Callback<void> | No | Callback function that returns no result. This callback cancels listening for my-location icon tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = () => {
console.info("myLocationButtonClick", `callback1`);
};
let callback2 = () => {
console.info("myLocationButtonClick", `callback2`);
};
let callback3 = () => {
console.info("myLocationButtonClick", `callback3`);
};
mapEventManager.on("myLocationButtonClick", callback1);
mapEventManager.on("myLocationButtonClick", callback2);
mapEventManager.on("myLocationButtonClick", callback3);
// Cancel only the event response of the callback1 object. When a myLocationButtonClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('myLocationButtonClick', callback1);
// Cancel all myLocationButtonClick event responses.
mapEventManager.off('myLocationButtonClick'); on(type: 'myLocationClick', callback: Callback<mapCommon.LatLng>): void
Listens for my location tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'myLocationClick': my location tap event. |
| callback | Callback<mapCommon.LatLng> | Yes | Callback function, which returns mapCommon.LatLng. This callback listens for my location tap events. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("myLocationClick", `callback1 position = ${position.longitude}`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("myLocationClick", `callback2 position = ${position.longitude}`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("myLocationClick", `callback3 position = ${position.longitude}`);
};
mapEventManager.on("myLocationClick", callback1);
mapEventManager.on("myLocationClick", callback2);
mapEventManager.on("myLocationClick", callback3); off(type: 'myLocationClick', callback?: Callback<mapCommon.LatLng>): void
Cancels listening for my location tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'myLocationClick': my location tap event. |
| callback | Callback<mapCommon.LatLng> | No | Callback function, which returns mapCommon.LatLng. This callback cancels listening for my location tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (position: mapCommon.LatLng) => {
console.info("myLocationClick", `callback1 position`);
};
let callback2 = (position: mapCommon.LatLng) => {
console.info("myLocationClick", `callback2 position`);
};
let callback3 = (position: mapCommon.LatLng) => {
console.info("myLocationClick", `callback3 position`);
};
mapEventManager.on("myLocationClick", callback1);
mapEventManager.on("myLocationClick", callback2);
mapEventManager.on("myLocationClick", callback3);
// Cancel only the event response of the callback1 object. When a myLocationClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('myLocationClick', callback1);
// Cancel all myLocationClick event responses.
mapEventManager.off('myLocationClick'); on(type: 'poiClick', callback: Callback<mapCommon.Poi>): void
Listens for POI tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'poiClick': POI tap event. |
| callback | Callback<mapCommon.Poi> | Yes | Callback function, which returns mapCommon.Poi. This callback listens for POI tap events. |
Example:
let callback1 = (poi: mapCommon.Poi) => {
console.info("poiClick", `callback1 poi = ${poi.id}`);
};
let callback2 = (poi: mapCommon.Poi) => {
console.info("poiClick", `callback2 poi = ${poi.id}`);
};
let callback3 = (poi: mapCommon.Poi) => {
console.info("poiClick", `callback3 poi = ${poi.id}`);
};
mapEventManager.on("poiClick", callback1);
mapEventManager.on("poiClick", callback2);
mapEventManager.on("poiClick", callback3); off(type: 'poiClick', callback?: Callback<mapCommon.Poi>): void
Cancels listening for POI tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'poiClick': POI tap event. |
| callback | Callback<mapCommon.Poi> | No | Callback function, which returns mapCommon.Poi. This callback cancels listening for POI tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (poi: mapCommon.Poi) => {
console.info("poiClick", `callback1 poi`);
};
let callback2 = (poi: mapCommon.Poi) => {
console.info("poiClick", `callback2 poi`);
};
let callback3 = (poi: mapCommon.Poi) => {
console.info("poiClick", `callback3 poi`);
};
mapEventManager.on("poiClick", callback1);
mapEventManager.on("poiClick", callback2);
mapEventManager.on("poiClick", callback3);
// Cancel only the event response of the callback1 object. When a poiClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('poiClick', callback1);
// Cancel all poiClick event responses.
mapEventManager.off('poiClick'); on(type: 'markerClick', callback: Callback<Marker>): void
Listens for Marker tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerClick': Marker tap event. |
| callback | Callback<Marker> | Yes | Callback function, which returns Marker. This callback listens for Marker tap events. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerClick", `callback1 marker = ${marker.getId()}`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerClick", `callback2 marker = ${marker.getId()}`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerClick", `callback3 marker = ${marker.getId()}`);
};
mapEventManager.on("markerClick", callback1);
mapEventManager.on("markerClick", callback2);
mapEventManager.on("markerClick", callback3); off(type: 'markerClick', callback?: Callback<Marker>): void
Cancels listening for Marker tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerClick': Marker tap event. |
| callback | Callback<Marker> | No | Callback function, which returns Marker. This callback cancels listening for Marker tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerClick", `callback1 marker`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerClick", `callback2 marker`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerClick", `callback3 marker`);
};
mapEventManager.on("markerClick", callback1);
mapEventManager.on("markerClick", callback2);
mapEventManager.on("markerClick", callback3);
// Cancel only the event response of the callback1 object. When a markerClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('markerClick', callback1);
// Cancel all markerClick event responses.
mapEventManager.off('markerClick'); on(type: 'markerDragStart', callback: Callback<Marker>): void
Listens for Marker drag start events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerDragStart': Marker drag start event. |
| callback | Callback<Marker> | Yes | Callback function, which returns Marker. This callback listens for Marker drag start events. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerDragStart", `callback1 marker = ${marker.getId()}`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerDragStart", `callback2 marker = ${marker.getId()}`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerDragStart", `callback3 marker = ${marker.getId()}`);
};
mapEventManager.on("markerDragStart", callback1);
mapEventManager.on("markerDragStart", callback2);
mapEventManager.on("markerDragStart", callback3); off(type: 'markerDragStart', callback?: Callback<Marker>): void
Cancels listening for Marker drag start events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerDragStart': Marker drag start event. |
| callback | Callback<Marker> | No | Callback function, which returns Marker. This callback cancels listening for Marker drag start events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerDragStart", `callback1 marker`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerDragStart", `callback2 marker`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerDragStart", `callback3 marker`);
};
mapEventManager.on("markerDragStart", callback1);
mapEventManager.on("markerDragStart", callback2);
mapEventManager.on("markerDragStart", callback3);
// Cancel only the event response of the callback1 object. When a markerDragStart event occurs, callback2 and callback3 will be called.
mapEventManager.off('markerDragStart', callback1);
// Cancel all markerDragStart event responses.
mapEventManager.off('markerDragStart'); on(type: 'markerDrag', callback: Callback<Marker>): void
Listens for Marker drag events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerDrag': Marker drag event. |
| callback | Callback<Marker> | Yes | Callback function, which returns Marker. This callback listens for Marker drag events. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerDrag", `callback1 marker = ${marker.getId()}`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerDrag", `callback2 marker = ${marker.getId()}`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerDrag", `callback3 marker = ${marker.getId()}`);
};
mapEventManager.on("markerDrag", callback1);
mapEventManager.on("markerDrag", callback2);
mapEventManager.on("markerDrag", callback3); off(type: 'markerDrag', callback?: Callback<Marker>): void
Cancels listening for Marker drag events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerDrag': Marker drag event. |
| callback | Callback<Marker> | No | Callback function, which returns Marker. This callback cancels listening for Marker drag events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerDrag", `callback1 marker`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerDrag", `callback2 marker`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerDrag", `callback3 marker`);
};
mapEventManager.on("markerDrag", callback1);
mapEventManager.on("markerDrag", callback2);
mapEventManager.on("markerDrag", callback3);
// Cancel only the event response of the callback1 object. When a markerDrag event occurs, callback2 and callback3 will be called.
mapEventManager.off('markerDrag', callback1);
// Cancel all markerDrag event responses.
mapEventManager.off('markerDrag'); on(type: 'markerDragEnd', callback: Callback<Marker>): void
Listens for Marker drag end events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerDragEnd': Marker drag end event. |
| callback | Callback<Marker> | Yes | Callback function, which returns Marker. This callback listens for Marker drag end events. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerDragEnd", `callback1 marker = ${marker.getId()}`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerDragEnd", `callback2 marker = ${marker.getId()}`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerDragEnd", `callback3 marker = ${marker.getId()}`);
};
mapEventManager.on("markerDragEnd", callback1);
mapEventManager.on("markerDragEnd", callback2);
mapEventManager.on("markerDragEnd", callback3); off(type: 'markerDragEnd', callback?: Callback<Marker>): void
Cancels listening for Marker drag end events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'markerDragEnd': Marker drag end event. |
| callback | Callback<Marker> | No | Callback function, which returns Marker. This callback cancels listening for Marker drag end events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (marker: map.Marker) => {
console.info("markerDragEnd", `callback1 marker`);
};
let callback2 = (marker: map.Marker) => {
console.info("markerDragEnd", `callback2 marker`);
};
let callback3 = (marker: map.Marker) => {
console.info("markerDragEnd", `callback3 marker`);
};
mapEventManager.on("markerDragEnd", callback1);
mapEventManager.on("markerDragEnd", callback2);
mapEventManager.on("markerDragEnd", callback3);
// Cancel only the event response of the callback1 object. When a markerDragEnd event occurs, callback2 and callback3 will be called.
mapEventManager.off('markerDragEnd', callback1);
// Cancel all markerDragEnd event responses.
mapEventManager.off('markerDragEnd'); on(type: 'circleClick', callback: Callback<MapCircle>): void
Listens for MapCircle tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'circleClick': MapCircle tap event. |
| callback | Callback<MapCircle> | Yes | Callback function, which returns MapCircle. This callback listens for MapCircle tap events. |
Example:
let callback1 = (circle: map.MapCircle) => {
console.info("circleClick", `callback1 circle = ${circle.getId()}`);
};
let callback2 = (circle: map.MapCircle) => {
console.info("circleClick", `callback2 circle = ${circle.getId()}`);
};
let callback3 = (circle: map.MapCircle) => {
console.info("circleClick", `callback3 circle = ${circle.getId()}`);
};
mapEventManager.on("circleClick", callback1);
mapEventManager.on("circleClick", callback2);
mapEventManager.on("circleClick", callback3); off(type: 'circleClick', callback?: Callback<MapCircle>): void
Cancels listening for MapCircle tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'circleClick': MapCircle tap event. |
| callback | Callback<MapCircle> | No | Callback function, which returns MapCircle. This callback cancels listening for MapCircle tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (circle: map.MapCircle) => {
console.info("circleClick", `callback1 circle`);
};
let callback2 = (circle: map.MapCircle) => {
console.info("circleClick", `callback2 circle`);
};
let callback3 = (circle: map.MapCircle) => {
console.info("circleClick", `callback3 circle`);
};
mapEventManager.on("circleClick", callback1);
mapEventManager.on("circleClick", callback2);
mapEventManager.on("circleClick", callback3);
// Cancel only the event response of the callback1 object. When a circleClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('circleClick', callback1);
// Cancel all circleClick event responses.
mapEventManager.off('circleClick'); on(type: 'polylineClick', callback: Callback<MapPolyline>): void
Listens for MapPolyline tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'polylineClick': MapPolyline tap event. |
| callback | Callback<MapPolyline> | Yes | Callback function, which returns MapPolyline. This callback listens for MapPolyline tap events. |
Example:
let callback1 = (polyline: map.MapPolyline) => {
console.info("polylineClick", `callback1 polyline = ${polyline.getId()}`);
};
let callback2 = (polyline: map.MapPolyline) => {
console.info("polylineClick", `callback2 polyline = ${polyline.getId()}`);
};
let callback3 = (polyline: map.MapPolyline) => {
console.info("polylineClick", `callback3 polyline = ${polyline.getId()}`);
};
mapEventManager.on("polylineClick", callback1);
mapEventManager.on("polylineClick", callback2);
mapEventManager.on("polylineClick", callback3); off(type: 'polylineClick', callback?: Callback<MapPolyline>): void
Cancels listening for MapPolyline tap event. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'polylineClick': MapPolyline tap event. |
| callback | Callback<MapPolyline> | No | Callback function, which returns MapPolyline. This callback cancels listening for MapPolyline tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (polyline: map.MapPolyline) => {
console.info("polylineClick", `callback1 polyline`);
};
let callback2 = (polyline: map.MapPolyline) => {
console.info("polylineClick", `callback2 polyline`);
};
let callback3 = (polyline: map.MapPolyline) => {
console.info("polylineClick", `callback3 polyline`);
};
mapEventManager.on("polylineClick", callback1);
mapEventManager.on("polylineClick", callback2);
mapEventManager.on("polylineClick", callback3);
// Cancel only the event response of the callback1 object. When a polylineClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('polylineClick', callback1);
// Cancel all polylineClick event responses.
mapEventManager.off('polylineClick'); on(type: 'polygonClick', callback: Callback<MapPolygon>): void
Listens for MapPolygon tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'polygonClick': MapPolygon tap event. |
| callback | Callback<MapPolygon> | Yes | Callback function, which returns MapPolygon. This callback listens for MapPolygon tap events. |
Example:
let callback1 = (polygon: map.MapPolygon) => {
console.info("polygonClick", `callback1 polygon = ${polygon.getId()}`);
};
let callback2 = (polygon: map.MapPolygon) => {
console.info("polygonClick", `callback2 polygon = ${polygon.getId()}`);
};
let callback3 = (polygon: map.MapPolygon) => {
console.info("polygonClick", `callback3 polygon = ${polygon.getId()}`);
};
mapEventManager.on("polygonClick", callback1);
mapEventManager.on("polygonClick", callback2);
mapEventManager.on("polygonClick", callback3); off(type: 'polygonClick', callback?: Callback<MapPolygon>): void
Cancels listening for MapPolygon tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'polygonClick': MapPolygon tap event. |
| callback | Callback<MapPolygon> | No | Callback function, which returns MapPolygon. This callback cancels listening for MapPolygon tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (polygon: map.MapPolygon) => {
console.info("polygonClick", `callback1 polygon`);
};
let callback2 = (polygon: map.MapPolygon) => {
console.info("polygonClick", `callback2 polygon`);
};
let callback3 = (polygon: map.MapPolygon) => {
console.info("polygonClick", `callback3 polygon`);
};
mapEventManager.on("polygonClick", callback1);
mapEventManager.on("polygonClick", callback2);
mapEventManager.on("polygonClick", callback3);
// Cancel only the event response of the callback1 object. When a polygonClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('polygonClick', callback1);
// Cancel all polygonClick event responses.
mapEventManager.off('polygonClick'); on(type: 'infoWindowClick', callback: Callback<Marker>): void
Listens for information window tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'infoWindowClick': information window tap event. |
| callback | Callback<Marker> | Yes | Callback function, which returns Marker. This callback listens for information window tap events. |
Example:
let callback1 = (infoWindow: map.Marker) => {
console.info("infoWindowClick", `callback1 infoWindow = ${infoWindow.getId()}`);
};
let callback2 = (infoWindow: map.Marker) => {
console.info("infoWindowClick", `callback2 infoWindow = ${infoWindow.getId()}`);
};
let callback3 = (infoWindow: map.Marker) => {
console.info("infoWindowClick", `callback3 infoWindow = ${infoWindow.getId()}`);
};
mapEventManager.on("infoWindowClick", callback1);
mapEventManager.on("infoWindowClick", callback2);
mapEventManager.on("infoWindowClick", callback3); off(type: 'infoWindowClick', callback?: Callback<Marker>): void
Cancels listening for information window tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'infoWindowClick': information window tap event. |
| callback | Callback<Marker> | No | Callback function, which returns Marker. This callback cancels listening for information window tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (infoWindow: map.Marker) => {
console.info("infoWindowClick", `callback1 infoWindow`);
};
let callback2 = (infoWindow: map.Marker) => {
console.info("infoWindowClick", `callback2 infoWindow`);
};
let callback3 = (infoWindow: map.Marker) => {
console.info("infoWindowClick", `callback3 infoWindow`);
};
mapEventManager.on("infoWindowClick", callback1);
mapEventManager.on("infoWindowClick", callback2);
mapEventManager.on("infoWindowClick", callback3);
// Cancel only the event response of the callback1 object. When an infoWindowClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('infoWindowClick', callback1);
// Cancel all infoWindowClick event responses.
mapEventManager.off('infoWindowClick'); on(type: 'infoWindowClose', callback: Callback<Marker>): void
Listens for information window close events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'infoWindowClose': information window close event. |
| callback | Callback<Marker> | Yes | Callback function, which returns Marker. This callback listens for information window close events. |
Example:
let callback1 = (infoWindow: map.Marker) => {
console.info("infoWindowClose", `callback1 infoWindowClose = ${infoWindow.getId()}`);
};
let callback2 = (infoWindow: map.Marker) => {
console.info("infoWindowClose", `callback2 infoWindowClose = ${infoWindow.getId()}`);
};
let callback3 = (infoWindow: map.Marker) => {
console.info("infoWindowClose", `callback3 infoWindowClose = ${infoWindow.getId()}`);
};
mapEventManager.on("infoWindowClose", callback1);
mapEventManager.on("infoWindowClose", callback2);
mapEventManager.on("infoWindowClose", callback3); off(type: 'infoWindowClose', callback?: Callback<Marker>): void
Cancels listening for information window close events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'infoWindowClose': information window close event. |
| callback | Callback<Marker> | No | Callback function, which returns Marker. This callback cancels listening for information window close events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (infoWindow: map.Marker) => {
console.info("infoWindowClose", `callback1 infoWindowClose`);
};
let callback2 = (infoWindow: map.Marker) => {
console.info("infoWindowClose", `callback2 infoWindowClose`);
};
let callback3 = (infoWindow: map.Marker) => {
console.info("infoWindowClose", `callback3 infoWindowClose`);
};
mapEventManager.on("infoWindowClose", callback1);
mapEventManager.on("infoWindowClose", callback2);
mapEventManager.on("infoWindowClose", callback3);
// Cancel only the event response of the callback1 object. When an infoWindowClose event occurs, callback2 and callback3 will be called.
mapEventManager.off('infoWindowClose', callback1);
// Cancel all infoWindowClose event responses.
mapEventManager.off('infoWindowClose'); on(type: 'pointAnnotationClick', callback: Callback<PointAnnotation>): void
Listens for PointAnnotation tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'pointAnnotationClick': PointAnnotation tap event. |
| callback | Callback<PointAnnotation> | Yes | Callback function, which returns PointAnnotation. This callback listens for PointAnnotation tap events. |
Example:
let callback1 = (pointAnnotation: map.PointAnnotation) => {
console.info("pointAnnotationClick", `callback1 pointAnnotation = ${pointAnnotation.getId()}`);
};
let callback2 = (pointAnnotation: map.PointAnnotation) => {
console.info("pointAnnotationClick", `callback2 pointAnnotation = ${pointAnnotation.getId()}`);
};
let callback3 = (pointAnnotation: map.PointAnnotation) => {
console.info("pointAnnotationClick", `callback3 pointAnnotation = ${pointAnnotation.getId()}`);
};
mapEventManager.on("pointAnnotationClick", callback1);
mapEventManager.on("pointAnnotationClick", callback2);
mapEventManager.on("pointAnnotationClick", callback3); off(type: 'pointAnnotationClick', callback?: Callback<PointAnnotation>): void
Cancels listening for PointAnnotation tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'pointAnnotationClick': PointAnnotation tap event. |
| callback | Callback<PointAnnotation> | No | Callback function, which returns PointAnnotation. This callback cancels listening for PointAnnotation tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (pointAnnotation: map.PointAnnotation) => {
console.info("pointAnnotationClick", `callback1 pointAnnotation`);
};
let callback2 = (pointAnnotation: map.PointAnnotation) => {
console.info("pointAnnotationClick", `callback2 pointAnnotation`);
};
let callback3 = (pointAnnotation: map.PointAnnotation) => {
console.info("pointAnnotationClick", `callback3 pointAnnotation`);
};
mapEventManager.on("pointAnnotationClick", callback1);
mapEventManager.on("pointAnnotationClick", callback2);
mapEventManager.on("pointAnnotationClick", callback3);
// Cancel only the event response of the callback1 object. When a pointAnnotationClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('pointAnnotationClick', callback1);
// Cancel all pointAnnotationClick event responses.
mapEventManager.off('pointAnnotationClick'); on(type: 'bubbleClick', callback: Callback<Bubble>): void
Listens for Bubble tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'bubbleClick': Bubble tap event. |
| callback | Callback<Bubble> | Yes | Callback function, which returns Bubble. This callback listens for Bubble tap events. |
Example:
let callback1 = (bubble: map.Bubble) => {
console.info("bubbleClick", `callback1 bubble = ${bubble.getId()}`);
};
let callback2 = (bubble: map.Bubble) => {
console.info("bubbleClick", `callback2 bubble = ${bubble.getId()}`);
};
let callback3 = (bubble: map.Bubble) => {
console.info("bubbleClick", `callback3 bubble = ${bubble.getId()}`);
};
mapEventManager.on("bubbleClick", callback1);
mapEventManager.on("bubbleClick", callback2);
mapEventManager.on("bubbleClick", callback3); off(type: 'bubbleClick', callback?: Callback<Bubble>): void
Cancels listening for Bubble tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'bubbleClick': Bubble tap event. |
| callback | Callback<Bubble> | No | Callback function, which returns Bubble. This callback cancels listening for Bubble tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (bubble: map.Bubble) => {
console.info("bubbleClick", `callback1 bubble`);
};
let callback2 = (bubble: map.Bubble) => {
console.info("bubbleClick", `callback2 bubble`);
};
let callback3 = (bubble: map.Bubble) => {
console.info("bubbleClick", `callback3 bubble`);
};
mapEventManager.on("bubbleClick", callback1);
mapEventManager.on("bubbleClick", callback2);
mapEventManager.on("bubbleClick", callback3);
// Cancel only the event response of the callback1 object. When a bubbleClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('bubbleClick', callback1);
// Cancel all bubbleClick event responses.
mapEventManager.off('bubbleClick'); on(type: 'imageOverlayClick', callback: Callback<ImageOverlay>): void
Listens for ImageOverlay tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'imageOverlayClick': ImageOverlay tap event. |
| callback | Callback<ImageOverlay> | Yes | Callback function, which returns ImageOverlay. This callback listens for ImageOverlay tap events. |
Example:
let callback1 = (imageOverlay: map.ImageOverlay) => {
console.info("imageOverlayClick", `callback1 imageOverlay = ${imageOverlay.getId()}`);
};
let callback2 = (imageOverlay: map.ImageOverlay) => {
console.info("imageOverlayClick", `callback2 imageOverlay = ${imageOverlay.getId()}`);
};
let callback3 = (imageOverlay: map.ImageOverlay) => {
console.info("imageOverlayClick", `callback3 imageOverlay = ${imageOverlay.getId()}`);
};
mapEventManager.on("imageOverlayClick", callback1);
mapEventManager.on("imageOverlayClick", callback2);
mapEventManager.on("imageOverlayClick", callback3); off(type: 'imageOverlayClick', callback?: Callback<ImageOverlay>): void
Cancels listening for ImageOverlay tap events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'imageOverlayClick': ImageOverlay tap event. |
| callback | Callback<ImageOverlay> | No | Callback function, which returns ImageOverlay. This callback cancels listening for ImageOverlay tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (imageOverlay: map.ImageOverlay) => {
console.info("imageOverlayClick", `callback1 imageOverlay`);
};
let callback2 = (imageOverlay: map.ImageOverlay) => {
console.info("imageOverlayClick", `callback2 imageOverlay`);
};
let callback3 = (imageOverlay: map.ImageOverlay) => {
console.info("imageOverlayClick", `callback3 imageOverlay`);
};
mapEventManager.on("imageOverlayClick", callback1);
mapEventManager.on("imageOverlayClick", callback2);
mapEventManager.on("imageOverlayClick", callback3);
// Cancel only the event response of the callback1 object. When an imageOverlayClick event occurs, callback2 and callback3 will be called.
mapEventManager.off('imageOverlayClick', callback1);
// Cancel all imageOverlayClick event responses.
mapEventManager.off('imageOverlayClick'); on(type: 'error', callback: ErrorCallback): void
Listening for error events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'error': error event. |
| callback | ErrorCallback | Yes | Callback function, which returns ErrorCallback. This callback listens for error events. |
Example:
import { BusinessError } from '@kit.BasicServicesKit';
let callback1 = (error: BusinessError) => {
console.error("error", `callback1 code: ${error.code}, message: ${error.message}`);
};
let callback2 = (error: BusinessError) => {
console.error("error", `callback2 code: ${error.code}, message: ${error.message}`);
};
let callback3 = (error: BusinessError) => {
console.error("error", `callback3 code: ${error.code}, message: ${error.message}`);
};
mapEventManager.on("error", callback1);
mapEventManager.on("error", callback2);
mapEventManager.on("error", callback3); off(type: 'error', callback?: ErrorCallback): void
Listening for error events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'error': error event. |
| callback | ErrorCallback | No | Callback function, which returns ErrorCallback. This callback cancels listening for error events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
import { BusinessError } from '@kit.BasicServicesKit';
let callback1 = (error: BusinessError) => {
console.info("error", `callback1`);
};
let callback2 = (error: BusinessError) => {
console.info("error", `callback2`);
};
let callback3 = (error: BusinessError) => {
console.info("error", `callback3`);
};
mapEventManager.on("error", callback1);
mapEventManager.on("error", callback2);
mapEventManager.on("error", callback3);
// Cancel only the event response of the callback1 object. When an error event occurs, callback2 and callback3 will be called.
mapEventManager.off('error', callback1);
// Cancel all error event responses.
mapEventManager.off('error'); on(type: 'indoorMapEnter', callback: Callback<IndoorMapInfo>): void
Listens for indoor map entered events.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.1.1(19).
System capability: SystemCapability.Map.Core
Device behavior differences: For version 5.1.1(19) or later, this API is supported on phones, tablets, and PCs/2-in-1 devices. On other device types, it returns error code 801.
Since: 5.1.1(19)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'indoorMapEnter': indoor map entered event. |
| callback | Callback<IndoorMapInfo> | Yes | Callback function, which returns IndoorMapInfo. This callback listens for indoor map entered events. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
Example:
let callback = (indoorMapInfo: map.IndoorMapInfo) => {
console.info("indoorMapEnter", `callback indoorMapInfo`);
};
mapEventManager.on("indoorMapEnter", callback); off(type: 'indoorMapEnter', callback?: Callback<IndoorMapInfo>): void
Cancels listening for indoor map entered events.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.1.1(19).
System capability: SystemCapability.Map.Core
Device behavior differences: For version 5.1.1(19) or later, this API is supported on phones, tablets, and PCs/2-in-1 devices. On other device types, it returns error code 801.
Since: 5.1.1(19)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'indoorMapEnter': indoor map entered event. |
| callback | Callback<IndoorMapInfo> | No | Callback function, which returns IndoorMapInfo. This callback cancels listening for indoor map entered events. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
Example:
let callback = (indoorMapInfo: map.IndoorMapInfo) => {
console.info("indoorMapEnter", `callback`);
};
mapEventManager.on("indoorMapEnter", callback);
// Cancel the event response of the callback object.
mapEventManager.off('indoorMapEnter', callback); on(type: 'indoorMapExit', callback: Callback<void>): void
Listens for indoor map exited events.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.1.1(19).
System capability: SystemCapability.Map.Core
Device behavior differences: For version 5.1.1(19) or later, this API is supported on phones, tablets, and PCs/2-in-1 devices. On other device types, it returns error code 801.
Since: 5.1.1(19)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'indoorMapExit': indoor map exited event. |
| callback | Callback<void> | Yes | Callback function that returns no result. This callback listens for indoor map exited events. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
Example:
let callback = () => {
console.info("indoorMapExit", `callback`);
};
mapEventManager.on("indoorMapExit", callback); off(type: 'indoorMapExit', callback?: Callback<void>): void
Cancels listening for indoor map exited events.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 5.1.1(19).
System capability: SystemCapability.Map.Core
Device behavior differences: For version 5.1.1(19) or later, this API is supported on phones, tablets, and PCs/2-in-1 devices. On other device types, it returns error code 801.
Since: 5.1.1(19)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'indoorMapExit': indoor map exited event. |
| callback | Callback<void> | No | Callback function that returns no result. This callback cancels listening for indoor map exited events. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
Example:
let callback = () => {
console.info("indoorMapExit", `callback`);
};
mapEventManager.on("indoorMapExit", callback);
// Cancel the event response of the callback object.
mapEventManager.off('indoorMapExit', callback); on(type: 'massPointOverlayClick', callback: MassPointOverlayCallback): void
Listens for MassPointOverlay tap events.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'massPointOverlayClick': MassPointOverlay tap event. |
| callback | MassPointOverlayCallback | Yes | Callback function that returns no result. This callback listens for MassPointOverlay tap events. |
Example:
// Initialize the listening event manager of the map component.
let mapEventManager = this.mapController.getEventManager();
let massCallback: map.MassPointOverlayCallback = (overlay, item) => {
console.info(`overlayId:${overlay.getId()},item :${JSON.stringify(item)}`);
}
// Start listening for MassPointOverlay tap events.
mapEventManager.on('massPointOverlayClick', massCallback); off(type: 'massPointOverlayClick', callback?: MassPointOverlayCallback): void
Cancels listening for MassPointOverlay tap events.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 6.0.0(20).
System capability: SystemCapability.Map.Core
Since: 6.0.0(20)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| type | string | Yes | 'massPointOverlayClick': MassPointOverlay tap events. |
| callback | MassPointOverlayCallback | No | Callback function that returns no result. This callback cancels listening for MassPointOverlay tap events. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
// Initialize the listening event manager of the map component.
let mapEventManager = this.mapController.getEventManager();
let massCallback: map.MassPointOverlayCallback = (overlay, item) => {
console.info(`overlayId:${overlay.getId()},item :${JSON.stringify(item)}`);
}
// Start listening for MassPointOverlay tap events.
mapEventManager.on('massPointOverlayClick', massCallback);
// Stop specific listening for MassPointOverlay tap events by passing the corresponding callback.
mapEventManager.off('massPointOverlayClick', massCallback);
// Stop all listening for MassPointOverlay tap events. No callback needs to be passed.
mapEventManager.off('massPointOverlayClick'); onMarkerLongClick(callback: Callback<Marker>): void
Listens for Marker long-press events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 6.1.1(24).
System capability: SystemCapability.Map.Core
Since: 6.1.1(24)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| callback | Callback<Marker> | Yes | Callback function for Marker long-press events, which returns the Marker. |
Example:
let callback1 = (markerLong: map.Marker) => {
console.info("markerLongClick", `callback1 markerLongClick = ${markerLong.getId()}`);
};
let callback2 = (markerLong: map.Marker) => {
console.info("markerLongClick", `callback2 markerLongClick = ${markerLong.getId()}`);
};
let callback3 = (markerLong: map.Marker) => {
console.info("markerLongClick", `callback3 markerLongClick = ${markerLong.getId()}`);
};
mapEventManager.onMarkerLongClick(callback1);
mapEventManager.onMarkerLongClick(callback2);
mapEventManager.onMarkerLongClick(callback3); offMarkerLongClick(callback?: Callback<Marker>): void
Cancels listening for Marker long-press events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 6.1.1(24).
System capability: SystemCapability.Map.Core
Since: 6.1.1(24)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| callback | Callback<Marker> | No | Callback function for Marker long-press events, which returns the Marker. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (markerLong: map.Marker) => {
console.info("markerLongClick", `callback1 markerLongClick = ${markerLong.getId()}`);
};
let callback2 = (markerLong: map.Marker) => {
console.info("markerLongClick", `callback2 markerLongClick = ${markerLong.getId()}`);
};
let callback3 = (markerLong: map.Marker) => {
console.info("markerLongClick", `callback3 markerLongClick = ${markerLong.getId()}`);
};
mapEventManager.onMarkerLongClick(callback1);
mapEventManager.onMarkerLongClick(callback2);
mapEventManager.onMarkerLongClick(callback3);
// Cancel only the event response of the callback1 object. When a markerLongClick event occurs, callback2 and callback3 will be called.
mapEventManager.offMarkerLongClick(callback1);
// Cancel all markerLongClick event responses.
mapEventManager.offMarkerLongClick(); onPoiLongClick(callback: Callback<mapCommon.Poi>): void
Listens for map POI long-press events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 6.1.1(24).
System capability: SystemCapability.Map.Core
Since: 6.1.1(24)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| callback | Callback<mapCommon.Poi> | Yes | Callback function for map POI long-press events, which returns mapCommon.Poi. |
Example:
let callback1 = (poi: mapCommon.Poi) => {
console.info("poiLongClick", `callback1 poi = ${poi.id}`);
};
let callback2 = (poi: mapCommon.Poi) => {
console.info("poiLongClick", `callback2 poi = ${poi.id}`);
};
let callback3 = (poi: mapCommon.Poi) => {
console.info("poiLongClick", `callback3 poi = ${poi.id}`);
};
mapEventManager.onPoiLongClick(callback1);
mapEventManager.onPoiLongClick(callback2);
mapEventManager.onPoiLongClick(callback3); offPoiLongClick(callback?: Callback<mapCommon.Poi>): void
Cancels listening for map POI long-press events. This API can use multiple asynchronous callbacks to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 6.1.1(24).
System capability: SystemCapability.Map.Core
Since: 6.1.1(24)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| callback | Callback<mapCommon.Poi> | No | Callback function for map POI long-press events, which returns mapCommon.Poi. - If callback is null, cancel all callbacks. - If callback is not null, cancel the specified callback. |
Example:
let callback1 = (poi: mapCommon.Poi) => {
console.info("poiLongClick", `callback1 poi = ${poi.id}`);
};
let callback2 = (poi: mapCommon.Poi) => {
console.info("poiLongClick", `callback2 poi = ${poi.id}`);
};
let callback3 = (poi: mapCommon.Poi) => {
console.info("poiLongClick", `callback3 poi = ${poi.id}`);
};
mapEventManager.onPoiLongClick(callback1);
mapEventManager.onPoiLongClick(callback2);
mapEventManager.onPoiLongClick(callback3);
// Cancel only the event response of the callback1 object. When a poiLongClick event occurs, callback2 and callback3 will be called.
mapEventManager.offPoiLongClick(callback1);
// Cancel all poiLongClick event responses.
mapEventManager.offPoiLongClick();