Skip to content

@windy/broadcast

Major Windy's event emitter (instance of class Evented), used for announcing the most important events.

Example

js
import broadcast from '@windy/broadcast';

const listener = params => console.log('Params has changed', params);

broadcast.on('redrawFinished', listener );

broadcast.once('metricChanged', params => {
    // This method will be called just once
});

// Do not forget to unsubscribe any listener
broadcast.off('redrawFinished', listener);

// Let's fire some event
broadcast.emit('rqstOpen', 'menu');

Type parameters

NameType
Textends keyof Plugins

Hierarchy

Table of contents

Properties

Properties

closeAllPlugins

closeAllPlugins: [] | [keyof Plugins]

Request to close all opened plugins (unless plugin has noClose property)


dependenciesResolved

dependenciesResolved: []

Basically most important broadcast of all, triggered just once, when Windy.com has been successfully loaded and all modules are ready to be consumed


metricChanged

metricChanged: [keyof MetricTypes, MetricItem]

Indicates that user changed any of the units (wind, temp, ...).


paramsChanged

paramsChanged: [WeatherParameters, keyof WeatherParameters]

When user changes some parameters (overlay, level, date etc...). Do not not use this event to start any intensive action since Windy now must load and render all the data. We recommend to use redrawFinished instead.


pluginClosed

pluginClosed: [string]

Plugin was successfully loaded and closed


pluginOpened

pluginOpened: [string]

Plugin was succesfully closed


redrawFinished

redrawFinished: [WeatherParameters]

Triggered when Windy has successfully loaded and rendered requested data. Use this for triggering your own tasks.


redrawLayers

redrawLayers: [] | [{ noCache: boolean }]

Forces various renderers to render layers, for example after reconfiguring color gradient, or changing particle animation settings.


routerParsed

routerParsed: [void | `windy-plugin-${string}` | keyof Plugins]

Indicates, that router has parsed URL and launched plugin that was requested in URL


rqstClose

rqstClose: [string | T]

Request to close plugin (either internal or external)


rqstOpen

rqstOpen: [string | T, PluginsOpenParams[T]]

Request to open plugin (either internal or external)