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.
Called by MapLibre when this overlay is added to a map as an IControl.
The MapLibre map this overlay is being attached to.
The DOM element rendered by this overlay.
Called by MapLibre when this overlay is removed from a map. Detaches all map listeners, removes the custom layer, and destroys the underlying renderer.
Generic PubSub class implementing the Publish-Subscribe pattern for event handling.