File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
aspnetcore/blazor/includes/js-interop Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ When working with <xref:Microsoft.JSInterop.IJSObjectReference> in ASP.NET Core
2424
2525``` razor
2626@inject IJSRuntime JS
27- @implements IAsyncDisposable
27+ @implements IDisposable
2828
2929...
3030
@@ -36,18 +36,20 @@ When working with <xref:Microsoft.JSInterop.IJSObjectReference> in ASP.NET Core
3636 {
3737 if (firstRender)
3838 {
39- module = await JS.InvokeAsync<IJSInProcessObjectReference>("import",
40- "./scripts.js");
39+ var jsInProcess = (IJSInProcessRuntime)JS;
40+ module = await jsInProcess.Invoke<IJSInProcessObjectReference>("import",
41+ "./scripts.js");
42+ var value = module.Invoke<string>("javascriptFunctionIdentifier");
4143 }
4244 }
4345
4446 ...
4547
46- async ValueTask IAsyncDisposable.DisposeAsync ()
48+ void IDisposable.Dispose ()
4749 {
4850 if (module is not null)
4951 {
50- await module.DisposeAsync ();
52+ await module.Dispose ();
5153 }
5254 }
5355}
You can’t perform that action at this time.
0 commit comments