Skip to content

moonolgerd/Blazor.Notifications

Repository files navigation

Package Version

Blazor Notifications

Blazor Class Library for sending Web Notifications

Usage

Blazor.Server

Add to Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    services.AddNotifications();
}

Blazor.WebAssembly

Add to Program.cs

public static async Task Main(string[] args)
{
    builder.Services.AddNotifications();
}

Blazor.Server

Add to _Host.cshtml

<script src="_content/BlazorNotifications/notifier.js"></script>

Blazor.WebAssembly

Add to wwwroot/index.html

<script src="_content/BlazorNotifications/notifier.js"></script>

Add to your .razor file

@inject Blazor.Notifications.NotificationService NotificationService

Raise a notification

await NotificationService.CreateAsync("Hello from Blazor Notifier");