@windy/singleclick
Handles singleclick events on map and determines, which consumer should get it. If none is found, it emits event with click
topic, which is usually cached by @windy/picker
module and it opens weather picker on desired location.
Example
import { singleclick } from '@windy/singleclick';
// Plugin will get singleclick events ONLY if they are properly configured
// to get singleclick events
singleclick.on('windy-plugin-name', (ev) => {
console.log('I got singleclick event', ev);
})
Table of contents
Variables
Functions
Variables
singleclick
• Const
singleclick: Evented
<SingleclickTypes
>
Main singleclick event emitter (instance of class Evented.)
It contains well defined methods on
, off
and once
and it emits events, whose topic is one of eligible consumer
Functions
register
▸ register(ident
, priority
): keyof Plugins
Register the plugin (identified by its ident) to be on the list to receive singleclick events.
There can be only one listener with high priority (usually actually opened plugin), and one with low priority (usually some map layer).
Well configured plugins do not need to use this method, as they are automatically released, by Windy's plugin system when they are closed.
Parameters
Name | Type |
---|---|
ident | keyof Plugins |
priority | ListeningPriority |
Returns
keyof Plugins
release
▸ release(ident
, priority
): void
Release the plugin from the list of singleclick events. Well configured plugins do not need to use this method, as they are automatically released, by Windy's plugin system when they are closed.
Parameters
Name | Type |
---|---|
ident | keyof Plugins |
priority | ListeningPriority |
Returns
void