Skip to content

Commit 1f80543

Browse files
authored
Add WebAssembly-specific scheduler and update browserwasm condition (#268)
Use WasmScheduler.Default for WebAssembly targets to handle lack of multithreading, and update the csproj condition for browserwasm to use EndsWith for better compatibility.
1 parent f22ab3c commit 1f80543

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/ReactiveUI.Uno/Builder/UnoReactiveUIBuilderExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ public static IReactiveUIBuilder WithUno(this IReactiveUIBuilder builder)
7272

7373
return builder
7474
.WithUnoScheduler()
75+
#if __WASM__ || BROWSERWASM
76+
// WebAssembly doesn't support multithreading, use WasmScheduler instead of TaskPoolScheduler
77+
.WithTaskPoolScheduler(WasmScheduler.Default)
78+
#else
7579
.WithTaskPoolScheduler(TaskPoolScheduler.Default)
80+
#endif
7681
.WithPlatformModule<Uno.Registrations>()
7782
.WithUnoDictionary();
7883
}

src/ReactiveUI.Uno/ReactiveUI.Uno.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<ItemGroup>
3030
<PackageReference Include="ReactiveUI" />
3131
</ItemGroup>
32-
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-browserwasm'">
32+
<ItemGroup Condition="$(TargetFramework.EndsWith('0-browserwasm'))">
3333
<PackageReference Include="Reactive.Wasm" />
3434
</ItemGroup>
3535
<ItemGroup>

0 commit comments

Comments
 (0)