Skip to content

Repository files navigation

Notifications

Implementation of the Notification API in C# for Microsoft Blazor.

Build statusPackage VersionNuGet DownloadsLicense

Blazor Extensions

Blazor Extensions are a set of packages with the goal of adding useful things to Blazor.

Installation

Install-Package Blazor.Extensions.Notifications

Demo

There is a sample application in /tests/ folder For some other references of what the API does see the example demo

Usage

Add INotificationService via DI

Scoped by default.

publicvoidConfigureServices(IServiceCollectionservices){services.AddNotifications();}

Inject into component/pages

@usingBlazor.Extensions
@inject INotificationService NotificationService

or

Inject on a BlazorComponent class:

[Inject]privateINotificationService_notificationService{get;set;}

Create a notification

NotificationOptionsoptions=newNotificationOptions{Body=body,Icon=icon,};awaitNotificationService.CreateAsync(title,options);

Browser Support

boolIsSupportedByBrowser=NotificationService.IsSupportedByBrowserAsync();

Request Permission

PermissionTypepermission=awaitNotificationService.RequestPermissionAsync();

Contributions and feedback

Please feel free to use the component, open issues, fix bugs or provide feedback.

Contributors

This project is created and maintained by:

The following people are the maintainers of the Blazor Extensions projects:

About

HTML5 Notifications API implementation for Microsoft Blazor

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages