-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
According to https://docs.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-6.0#javascript-initializers, "Use of JS initializers often removes the need to manually add script references when using Razor class libraries (RCLs)."
Right now when I publish a RCL that uses JS interop, I need the user to reference my .js files in his own code, in some manner, as described in https://docs.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-6.0#location-of-javascipt
I fail to grasp how beforeStart(options)
and afterStarted(blazor)
could be used to load an external .js file. I see that Blazor can be started manually and a script injected according to https://docs.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-6.0#inject-a-script-after-blazor-starts, but that relies on the user changing autostart to false, and I'm not sure where to grab the blazor object from in the beforeStart(options)
JS callback. I didn't find documentation of the options
and blazor
JS objects.
Can anyone shed a little light on that? All I'm trying to do is to automagically load external .js files from an RCL with no user intervention besides loading the RCL NuGet.