BlazorJS is a small package to use a Scripts Component on every page or component to load JavaScript files when not loaded, and unload automatically.
Add the nuget Package BlazorJS
to your blazor project
Open _Imports.razor
from your project and add using for BlazorJS
...
@using BlazorJS
Now your are able to include every javascipt file easily to your pages or components.
For example open any page like the index.razor
and add
<Scripts src="js/myjsfile.js"></Scripts>
Multiple js files can be loaded with a comma seperator ,
<Scripts src="js/myjsfile.js, js/myjsfile2.js"></Scripts>
Notice this is an early first version of an idea to load and unload javascript dependencies for pages and components. Generel it is planned to enable easy bundling and minification