Feature type that user interaction handlers receive.
Module configuration type passed to config-change handlers.
Data type passed to shown-features handlers. Use never for
modules that have no show method.
The module-specific scope object where accepts besides a feature
predicate, or never for modules that only support predicates. It is unrelated to a module's
named scopes, which are properties on this object rather than an argument to it.
Feature type that user interaction handlers receive.
Module configuration type passed to config-change handlers.
Data type passed to shown-features handlers. Use never for
modules that have no show method.
The module-specific scope object where accepts besides a feature
predicate, or never for modules that only support predicates. It is unrelated to a module's
named scopes, which are properties on this object rather than an argument to it.
Removes all handlers for the given event type at once.
It accepts both user interaction types (click, contextmenu, hover, hover-move, long-hover,
dragstart, drag, dragend) and
module lifecycle types (config-change, and shown-features on a module that has a show method).
To remove a single handler, call the unsubscribe function that on returns instead,
which is also how a component cleans up on unmount: off also removes the handlers other
code put on the module, such as a plugin's.
The event type whose handlers should all be cleared.
Subscribes to a user interaction event (click, contextmenu, hover, hover-move, long-hover,
dragstart, drag, dragend).
The user event type.
Called with the feature, click/hover coordinates, the features at the point
from the source that drew it (under where(), the ones in its scope), and that source with
its layers.
An unsubscribe function. Call it to remove only this handler.
Subscribes to config-change events.
It fires after every change to the module's configuration, which What triggers config-change
lists. The handler receives the module's full updated configuration.
'config-change'
Receives the module's config, or undefined when the config is cleared.
An unsubscribe function. Call it to remove only this handler.
Subscribes to shown-features events.
It fires right after the module's show() method, or its equivalent, renders new data on
the map. Only modules that have a show method offer it.
'shown-features'
Receives what the module shows: the data passed to show(), or, from a module
that shows several kinds, an object naming which, such as PlacesModule's { places }
or { connections }.
An unsubscribe function. Call it to remove only this handler.
Narrows these events to part of what they cover, as UserEvents.where does.
A predicate over this module's feature type or, where the module supports one,
a scope object such as { layerGroups } on BaseMapModule.
Optionalconfig: EventHandlerConfig
Event configuration for handlers registered through the returned instance, so each scope can have its own hover cursor.
A UserEvents covering only the narrowed set. Lifecycle events stay on the module.
A module's user interaction and lifecycle events under a single
on/offsurface.User event types (
click,contextmenu,hover,hover-move,long-hover,dragstart,drag,dragend) 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. off also removes both user and module event types in bulk.Named scopes, where a module has them, hang off this object as properties. Each is a UserEventsWithStates, with user events and event states only, since lifecycle events stay here. where narrows ad hoc instead, and returns a plain UserEvents.
Example