Yes I saw this hack before, but it seems that it will keep loading the lib over and over, every time user loads the component. So I guess the best solution is to stick with adding and removing the script. To avoid the app to consume all the browser resources.
Hopefully we will have a better official solution implemented by @ivo, in a near future.
It would be great if we could have something like:
import { Windy } from 'windy';
const map = this.windy.create('#windy', {
lat: {{ LAT }},
lng: {{ LNG }},
zoom: {{ ZOOM }}
...ANY_LEAFLET_PROPERTY_AVAILABLE
});
and having Windy extending leaflet, so the map returned by the create()
would allow us to have access to any leaflet properties/methods