Skip to content

Commit 0965570

Browse files
authored
[Blazor] Call .NET from JS - OperatingSystem.IsBrowser() (#33846)
1 parent f679e7e commit 0965570

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

aspnetcore/blazor/javascript-interoperability/call-dotnet-from-javascript.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,6 @@ In the following `GenericsExample` component:
786786

787787
```razor
788788
@page "/generics-example"
789-
@using System.Runtime.InteropServices
790789
@implements IDisposable
791790
@inject IJSRuntime JS
792791
@@ -813,8 +812,7 @@ In the following `GenericsExample` component:
813812
814813
public async Task InvokeInterop()
815814
{
816-
var syncInterop =
817-
RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"));
815+
var syncInterop = OperatingSystem.IsBrowser();
818816
819817
await JS.InvokeVoidAsync(
820818
"invokeMethodsAsync", syncInterop, objRef1, objRef2);
@@ -834,7 +832,6 @@ In the following `GenericsExample` component:
834832

835833
```razor
836834
@page "/generics-example"
837-
@using System.Runtime.InteropServices
838835
@implements IDisposable
839836
@inject IJSRuntime JS
840837
@@ -861,8 +858,7 @@ In the following `GenericsExample` component:
861858
862859
public async Task InvokeInterop()
863860
{
864-
var syncInterop =
865-
RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"));
861+
var syncInterop = OperatingSystem.IsBrowser();
866862
867863
await JS.InvokeVoidAsync(
868864
"invokeMethodsAsync", syncInterop, objRef1, objRef2);

0 commit comments

Comments
 (0)