@ovwindy Also be aware that the latest version 36 appears to have a bug. gl-particles stopped working after upgrade to 36. L.CanvasLayer is not defined in the right place and this causes a DI error when adding @plugins/gl-particles The error messages and symptoms look like a require error.
Latest posts made by ovwindy
-
RE: Windy - Errors in lib.js started on 1st August
-
RE: Windy API development for single page applications
@helgiben After a few days of hacking and kludges we got windy to work again in a SPA in angular. It worked just fine with an old version of windy. Windy changed something Aug 1st. and I had to spend a few days trying to get the lastest up-to-date version of windy to work.
Anyway, to make a long story short even if you do get windy to work in a SPA, the solution will be short lived. This message now appears in the console: Repeatedly calling "windyInit" of an already initialized API is an unsupported functionality and will be removed in future versions
Due to the way angular works after you leave or destroy a component the div with windy is destroyed. When you visit the component again it is resurrected. You need to call windyInit again to get windy to work with the new div. That works just fine today. They are warning you that it will no longer work in the future. I suspect that windy divs in react or vue SPA's work the similarly?
I exchanged a few emails with windy tech support and they suggest to use windy in an iframe. That will not work with our setup.
-
RE: Windy - Errors in lib.js started on 1st August
@compassdsnm
We encountered the same bug. windy is set up to work on a standard single page website. To get it to work with angular we had to fix it to run with a local copy of libboot.js stuck on an old reliable version 23. Recently, about Aug 1st I would say, their wind overlay stopped working with version 23. We encountered the same params failed error when entering the weather map.The libboot.js at windy is now on version 36. It does not work with angular.
We had to hack and kludge. Finally by some miracle we got it to work.So anyway, since your page is protected by login, you are probably using some sort of modern mainstream framework to run your website. You are going to have to hack and kludge to get version 36 to work for you in your setup. Then the error goes away.
-
RE: How to shut windy down after leaving angular component?
I did not get an answer here. But after a few days of crazy hacking javascript internals I came up with this...
First, I use the standard off and remove methods to shut down leaflet v1.4.0 which windy works hand in hand with.
this.wmap.off();
this.wmap.remove();Secondly windy leaves a bunch of settings in the head which accumulate and compound every time a user visits a component with windy. These need to be cleared out of the head. See my clearHead method run in component ngDestroy below.
private clearHead() {
let head = document.getElementsByTagName('head')[0];
let scripts = head.getElementsByTagName('script');
let delscripts = [];
for (let script of scripts) {
if (script.outerHTML.indexOf('windy') !== -1) {
delscripts.push(script);
}
}
for (let script of delscripts) {
script.parentNode.removeChild(script);
}
let links = head.getElementsByTagName('link');
let dellinks = [];
for (let link of links) {
if (link.outerHTML.indexOf('windy') !== -1) {
dellinks.push(link);
}
}
for (let link of dellinks) {
link.parentNode.removeChild(link);
}
let styles = head.getElementsByTagName('style');
let delstyles = [];
for (let style of styles) {
if (style.outerHTML.indexOf('www.windy.com') !== -1) {
delstyles.push(style);
}
}
for (let style of delstyles) {
style.parentNode.removeChild(style);
}
}Next I close gl-particles. Even if one does not use particles in windy this seems to cause an error if visibility is ever lost to the browser. When you open another browser window or another app on your computer for example. Even after leaving the angular component with the windy map, the gl-particles events still trigger and cause errors. Shut the thing down on ngDestroy, it will start back up just fine when you return to the windy map component.
let www = window['W']; www['gl-particles'].close();
I reset window['W'] to the original condition. Hopefully garbage collectiion will eventually free up the memory used after leaving the component with the windy map. Not sure if this does anything. It does not seem to hurt.
delete window['W']; window['W'] = { version: "23.1.1", assets: "23.1.1.lib.baaa", sha: "a2400baaa", target: "lib", build: "2020-01-27, 09:01" };
Finally I knock on wood and hope that a better windy shut down mechanism becomes available.
-
How to shut windy down after leaving angular component?
I am moving our system from server side ASP.NET MVC to client side angular single page app.
We have a map that toggles between leaflet regular and weather overlay. Everything works fine except my boss showed me his CPU and GPU usage. It is very high after visiting the weather map and leaving. It does not bother me because I have lots of RAM and an NVidia graphics card. My boss has half of my RAM and a regular card. It makes a difference on his machine.
I need a way to destroy or stop windy from continuing to use resources after leaving the angular component with windy. I read this post (link above) by marekd and apparently this is not possible. Currently I just destory and plug window['W'] like so....
window['W'] = { version: "23.1.1", assets: "23.1.1.lib.baaa", sha: "a2400baaa", target: "lib", build: "2020-01-27, 09:01" };
I am not sure if what I do shuts windy down. Does anybody know of a better way to shut windy down after one leaves a component?