arivera12 / BlazorNotification

Blazor browser notifications from c# without any JavaScript library or dependency.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlazorNotification

Blazor browser notifications from c# without any JavaScript library or dependency.

Installation

Install-Package BlazorNotification -Version 1.0.1

Register the service in your services method

services.AddBlazorNotification();

No javascript library reference dependency

Usage

[Inject] IBlazorNotificationService BlazorNotificationService { get; set; }

Send a notification

Using a Function (basic)

await NotificationService.SendAsync("Title", "Description", "images/github.png");

Using NotificationOptions (advanced)

NotificationOptions options = new NotificationOptions
{
    Body = body,
    Icon = icon,
};

await NotificationService.SendAsync(title, options);

Browser Support

bool IsSupportedByBrowser = await NotificationService.IsSupportedByBrowserAsync()

Request Permission

PermissionType permission = await NotificationService.RequestPermissionAsync();

License

MIT

About

Blazor browser notifications from c# without any JavaScript library or dependency.

License:MIT License


Languages

Language:C# 100.0%