Feature type surfaced by user interaction handlers.
Module configuration type passed to config-change handlers.
Data type passed to shown-features handlers. Use never for
modules that have no show method.
Feature type surfaced by user interaction handlers.
Module configuration type passed to config-change handlers.
Data type passed to shown-features handlers. Use never for
modules that have no show method.
Remove all handlers for the given event type at once.
Accepts both user interaction types (click, contextmenu, hover, long-hover) and
module lifecycle types (config-change, shown-features).
Prefer the unsubscribe function returned by on when you need to remove a single
handler. Use off for bulk teardown — e.g. when unmounting a component that registered
multiple handlers of the same type.
The event type whose handlers should all be cleared.
Subscribe to a user interaction event (click, contextmenu, hover, long-hover).
The user event type.
Called with the feature, click/hover coordinates, all features at the point, and the source configuration.
An unsubscribe function. Call it to remove only this handler.
Subscribe to config-change events.
Fires after any configuration mutation — applyConfig, setVisible, or any
module-specific setter. The handler receives the module's full updated configuration.
'config-change'
Receives the module's config (or undefined when config is cleared).
An unsubscribe function. Call it to remove only this handler.
Subscribe to shown-features events.
Fires immediately after the module's show() method (or equivalent) has rendered
new data on the map. Only available on modules that have a show method.
'shown-features'
Receives the data that was passed to show().
An unsubscribe function. Call it to remove only this handler.
Unified events interface that blends user interaction events and module lifecycle events under a single
on/offsurface.User event types (
click,contextmenu,hover,long-hover) are handled by the underlying UserEvents instance and removed with off.Module lifecycle event types (
config-change,shown-features) are handled by the underlying ModuleEvents instance. Eachoncall returns an unsubscribe function. Both user and module event types are also removable in bulk via off.Example