The type of the event payload.
Optionaloptions: Partial<OptionallayerOptionalmapOptionaloriginReturns the AbortSignal for this PubSub instance. Use this signal with APIs that support cancellation (fetch, addEventListener, etc.) When the PubSub is destroyed, the signal will be aborted and all listeners using it will be automatically removed.
Unsubscribe a function previously subscribed with on
An event name to which the provided function was previously subscribed.
A function that was previously passed to on. The function must have the same reference as the function that was subscribed.
Subscribe a function to an event.
An event name which, when fired, will call the provided function.
A callback that gets called when the corresponding event is fired. The callback will get passed an argument with a type that's one of event payloads.
Optionaloptions: { signal?: AbortSignal }Optional options object. If a signal is provided, the subscription will be automatically cleaned up when that signal is aborted.
A cleanup function that unsubscribes the event listener when called.
Subscribe a function to be called when the signal is aborted.
The function to call when the signal is aborted.
Register a control on the map and give it a chance to register event listeners and resources. This method is called by Map#addControl internally.
the Map this control will be added to
The control's container element. This should be created by the control and returned by onAdd without being attached to the DOM: the map will insert the control's element into the DOM as necessary.
Unregister a control on the map and give it a chance to detach event listeners and resources. This method is called by Map#removeControl internally.
Generic PubSub class implementing the Publish-Subscribe pattern for event handling.