How to change the "favorite overlays" shown in the UI?



  • Using this does not work:

    W.store.set('favOverlays',['wind', 'gust', 'rain', 'rainAccu','snowAccu'])
    

    Does it require some emit/fire call to get the UI to update to reflect this change in the data store?



  • I think the problem is that you can't change favOverlays before the OverlaysMenu has initialize and registered its on("favOverlays") event listener. So the key is to modify favOverlays after OverlaysMenu has initialized. I'm not sure what the best event to listen for is, but redrawFinished works for me as shown below.

    var favInitComplete = false;
    
    // fix url for currents tiles
    W.products.sea.pathGenerator = 'https://www.windy.com/sst/latest/257w///{filename}.png';
    
    W.broadcast.on('redrawFinished', params => {
        if (!favInitComplete) {
            W.store.set('favOverlays',["wind", "gust", "currents"]);
            favInitComplete = true;
        }
    })
    

Log in to reply
 

Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
NodeBB & contributors, OSM & contributors, HERE maps

Looks like your connection to Windy Community was lost, please wait while we try to reconnect.