Skip to content
Permalink
Browse files

feature: Enable WASM on Blazor (#2295)

  • Loading branch information
richbryant authored and glennawatson committed Jan 1, 2020
1 parent a5099b4 commit 5d4d4f07ded6273d65d8654775006c6c5302cb0f
Showing with 5 additions and 14 deletions.
  1. +0 −2 src/ReactiveUI.Blazor/ReactiveUI.Blazor.csproj
  2. +5 −12 src/ReactiveUI.Blazor/Registrations.cs
@@ -1,5 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<PackageDescription>Contains the ReactiveUI platform specific extensions for Blazor</PackageDescription>
@@ -14,5 +13,4 @@
<ItemGroup>
<ProjectReference Include="..\ReactiveUI\ReactiveUI.csproj" />
</ItemGroup>

</Project>
@@ -4,10 +4,8 @@
// See the LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Reactive.PlatformServices;
using System.Text;

namespace ReactiveUI.Blazor
{
@@ -27,18 +25,13 @@ public void Register(Action<Func<object>, Type> registerFunction)

registerFunction(() => new PlatformOperations(), typeof(IPlatformOperations));

#if NETSTANDARD
if (WasmPlatformEnlightenmentProvider.IsWasm)
if (Type.GetType("Mono.Runtime") != null)
{
RxApp.TaskpoolScheduler = WasmScheduler.Default;
RxApp.MainThreadScheduler = WasmScheduler.Default;
}
else
#endif
{
RxApp.TaskpoolScheduler = TaskPoolScheduler.Default;
RxApp.MainThreadScheduler = new WaitForDispatcherScheduler(() => CurrentThreadScheduler.Instance);
PlatformEnlightenmentProvider.Current.EnableWasm();
}

RxApp.TaskpoolScheduler = TaskPoolScheduler.Default;
RxApp.MainThreadScheduler = CurrentThreadScheduler.Instance;
}
}
}

0 comments on commit 5d4d4f0

Please sign in to comment.
You can’t perform that action at this time.