MackinnonBuck / blazor-page-script

A Blazor component enabling per-page JavaScript initialization logic in statically rendered Blazor Web apps
MIT License
71 stars 8 forks source link

auto load our old js on load event #13

Open AmBplus opened 3 months ago

AmBplus commented 3 months ago

first of all thank you for providing this package , i have a asp.net core razor pages app and writing so many js code , now if i want to import them to blazor ssr with this way , need to go every js and wrapp them up inside of export function onLoad() {} , there is a way to tell auto loading the js file on some event like onLoad() ? on mean somthing like

and no need to write the export function onload anymore and this js file just run on load

MackinnonBuck commented 2 months ago

Hi @AmBplus,

If all you want to do is load a script dynamically, you don't need to wrap it in another script that defines an onLoad() handler. You can just reference the script directly from the <PageScript> component. The onLoad, onUpdate, and onDispose callbacks are optional, and only exist to implement functionality that responds to navigation events.

AmBplus commented 2 months ago

TNX , in asp.net core mvc or razor pages , we have asp-apend-version = true , so i don't need to change the file by myself , in this package we have something similar ?