Complete C# API documentation for browser APIs via Blazor WebAssembly. SpawnDev.BlazorJS provides 1,021 strongly typed C# wrappers that mirror the MDN Web API surface, giving Blazor WebAssembly applications full access to every browser API without writing a single line of JavaScript.
MDN Mapping: Every type listed in this documentation maps directly to its equivalent on MDN Web Docs. Where an MDN page exists for a JavaScript API, the corresponding SpawnDev.BlazorJS wrapper implements the same properties, methods, and events with C#-idiomatic naming. When in doubt, check the MDN page for the underlying JS behavior.
Supported .NET Versions: .NET 8, 9, and 10
Live Demo: blazorjs.spawndev.com
Two changes to Program.cs are all you need:
using SpawnDev.BlazorJS;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// 1. Add BlazorJSRuntime
builder.Services.AddBlazorJSRuntime();
// 2. Use BlazorJSRunAsync instead of RunAsync
await builder.Build().BlazorJSRunAsync();Then inject BlazorJSRuntime into any component or service:
[Inject]
BlazorJSRuntime JS { get; set; }For full setup details including worker scope detection and WebWorkerService, see Getting Started.
These guides cover the foundational types and patterns that every SpawnDev.BlazorJS developer should understand.
| Guide | Description |
|---|---|
| Getting Started | Installation, Program.cs setup, scope detection, first component |
| BlazorJSRuntime | The central interop service - Get, Set, Call, CallAsync, New, and more |
| JSObject | Base class for all typed JS wrappers - constructors, properties, methods, disposal |
| Events (ActionEvent / FuncEvent) | Type-safe event subscription with += / -= operators and automatic ref counting |
| Callbacks | Making .NET methods callable from JavaScript - Create, CreateOne, CallbackGroup |
| Union Types | TypeScript-style discriminated unions - Match, Map, Reduce |
| Undefinable | Distinguishing null from undefined in JavaScript interop |
| TypedArrays and Data Transfer | Uint8Array, Float32Array, ArrayBuffer, and all typed array types |
| HeapView (Zero-Copy) | Pin .NET arrays for zero-copy JavaScript access |
| Promises | JavaScript Promise wrapper - create from Task, lambda, or TaskCompletionSource |
| Worker Scope Detection | IsWindow, IsWorker, GlobalScope detection for multi-context apps |
| Custom JSObject Wrappers | Step-by-step guide to wrapping any JavaScript library |
| Disposal and Lifetime | Managing JSObject, Callback, and IJSInProcessObjectReference lifetimes |
| EnumString | Bidirectional enum-to-string mapping for JavaScript string constants |
| DynamicJSObject | DynamicObject wrapper for JavaScript-like dynamic property access |
| Blazor Web App Compatibility | .NET 8+ hosting model, prerendering, and InteractiveWebAssembly render mode |
Complete Class Index (1,021 types) - Every type documented, organized by category.
Organized by category, mirroring the MDN Web API index and the source folder structure. Each category links to a folder containing every class, interface, enum, and options type for that API.
These are library-specific types that provide the interop foundation.
| Type | Description |
|---|---|
| BlazorJSRuntime | Central interop service - global JS access, scope detection, script loading |
| JSObject | Base class for all 1,021 typed JavaScript wrappers |
| Callback | Makes .NET methods callable from JavaScript - ref-counted, disposable |
| ActionEvent | Event subscription with += / -= operators for Action delegates |
| FuncEvent | Event subscription with += / -= operators for Func delegates |
| CallbackGroup | Batch disposal container for multiple Callbacks |
| Union | TypeScript-style discriminated union types (Union<T1,T2> through Union<T1...T8>) |
| Undefinable | Distinguish JavaScript null from undefined |
| EnumString | Bidirectional enum-to-JS-string mapping |
| DynamicJSObject | DynamicObject wrapper for JavaScript-like dynamic access |
| EpochDateTime | Unix epoch timestamp conversion |
| FluentUsing | LINQ-style IDisposable extension methods |
- GitHub: github.com/LostBeard/SpawnDev.BlazorJS
- NuGet: nuget.org/packages/SpawnDev.BlazorJS
- Live Demo: blazorjs.spawndev.com
- Issues: github.com/LostBeard/SpawnDev.BlazorJS/issues
- Web Workers: github.com/LostBeard/SpawnDev.BlazorJS.WebWorkers (separate package)