forked from windycom/API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (19 loc) 路 737 Bytes
/
Copy pathscript.js
File metadata and controls
24 lines (19 loc) 路 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const options = {
key: 'PsLAtXpsPTZexBwUkO7Mx5I', // REPLACE WITH YOUR KEY !!!
};
windyInit(options, windyAPI => {
// All the params are stored in windyAPI.store
const { overlays, broadcast } = windyAPI;
const windMetric = overlays.wind.metric;
console.log(windMetric);
// 'kt' .. actually selected metric for wind overlay
// Read only value! Do not modify.
overlays.wind.listMetrics();
// ['kt', 'bft', 'm/s', 'km/h', 'mph'] .. available metrics
overlays.wind.setMetric('bft');
// Metric for wind was changed to bft
broadcast.on('metricChanged', (overlay, newMetric) => {
// Any changes of any metric can be observed here
console.log(overlay, newMetric);
});
});