Currently your documentation only shows the ability to load specific html. I have added a fix to let me include js as well, but it would be better IMO to have the routing take care of this. For reference, here is the function I use for loading js files:
function loadScript(name) {
let scripts = Array
.from(document.querySelectorAll('script'))
.map(scr => scr.src);
if (!scripts.includes(name)) {
var tag = document.createElement('script');
tag.src = name;
document.getElementsByTagName('body')[0].appendChild(tag);
}
}
This will prevent any script from being loaded more than once as well.
Currently your documentation only shows the ability to load specific html. I have added a fix to let me include js as well, but it would be better IMO to have the routing take care of this. For reference, here is the function I use for loading js files:
This will prevent any script from being loaded more than once as well.