Skip to content
HTML5 Notifications API implementation for Microsoft Blazor
C# HTML CSS TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update to latest versions of the client side packages. (#6) May 1, 2019
test Rename Imports.razor to _Imports.razor for sample. (#5) May 1, 2019
.editorconfig Initial project structure Jul 17, 2018
.gitignore
.vsts-ci.yml Update to Blazor 3.0.0-preview4 (#3) Apr 28, 2019
.vsts-release.yml Update to Blazor 3.0.0-preview4 (#3) Apr 28, 2019
Directory.Build.props Initial project structure Jul 17, 2018
Directory.Build.targets Initial project structure Jul 17, 2018
LICENSE Initial commit Jul 17, 2018
Notifications.sln Update to Blazor 3.0.0-preview4 (#3) Apr 28, 2019
README.md Provide Functions Documentation May 1, 2019

README.md

Notifications

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

Build status Package Version NuGet Downloads License

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.

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

Inject into component/pages

@using Blazor.Extensions
@inject INotificationService NotificationService

or

Inject on a BlazorComponent class:

[Inject] private INotificationService _notificationService { get; set; }

Create a notification

Using a Function (basic)

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

Using NotificationOptions (advanced)

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

await NotificationService.CreateAsync(title, options);

Browser Support

bool IsSupportedByBrowser = NotificationService.IsSupportedByBrowserAsync(); 

Request Permission

PermissionType permission = await NotificationService.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:

You can’t perform that action at this time.