I have kept the bundled script files in wwwroot folder of blazor_wasm app.
- I added the file using script tags in index.html
<script src="assets/plugins/global/plugins.bundle.js"></script>
<script src="assets/js/scripts.bundle.js"></script>
I have put scripts.bundle.js code in a function callJS
function callJS() {/** bundled js**/}
I called the function using js interops in a razor page but this is giving errors
protected override async Task OnAfterRenderAsync(bool firstRender){ if (firstRender) { await jsRuntime.InvokeVoidAsync("callJS"); } }
These are the errors
The return type of an async method must be void, Task, Task, a
task-like type, IAsyncEnumerable, or IAsyncEnumerator wasm_app'Index.OnAfterRenderAsync(bool)': return type must be 'Task' to match overridden member 'ComponentBase.OnAfterRenderAsync(bool)' wasm_app
Is this the correct way of running file or do I have to use another life cycle event?? I am using keen bootstrap theme which produces bundled js and css files using webpack.