Hi to all Javascript coders out there,
Does anybody have a new problem with the KnackInitAsync function? I noticed that since last week (Nov 1st), my app is now being executed twice. So I get doubled events for all “on render scene” and views, etc.
You can see it using this simple code:
console.log('000'); //Shown once
KnackInitAsync = function ($, callback) {
window.$ = $;
window.LazyLoad = LazyLoad;
console.log('111'); //Shown twice
LazyLoad.js([''/*whatever file you use, even empty does the same*/], () => {
console.log('222'); //Shown twice
callback();
})
};
I found this workaround, but it’s not clean:
var running = false;
KnackInitAsync = function ($, callback) {
if (running)
return;
else
running = true;
window.$ = $;
window.LazyLoad = LazyLoad;
LazyLoad.js([''/*whatever file you use, even empty does the same*/], () => {
console.log('111'); //Now shown once
callback();
})
};
Normand D.