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
30 lines (24 loc) · 819 Bytes
/
script.js
File metadata and controls
30 lines (24 loc) · 819 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
25
26
27
28
29
30
const options = {
key: 'PsLAtXpsPTZexBwUkO7Mx5I', // REPLACE WITH YOUR KEY !!!
// Tip: Use verbose true for nice console output
// verbose: true
};
windyInit(options, windyAPI => {
const { store, broadcast } = windyAPI;
// broadcast is main Windy's event emmiter that
// let you know what is happening inside
// Change overlays programatically
const overlays = ['rain', 'wind', 'temp', 'clouds'];
let i = 0;
setInterval(() => {
i = i === 3 ? 0 : i + 1;
store.set('overlay', overlays[i]);
}, 800);
// Observe the most important broadcasts
broadcast.on('paramsChanged', params => {
console.log('Params changed:', params);
});
broadcast.on('redrawFinished', params => {
console.log('Map was rendered:', params);
});
});