Blazor.Extensions.Notifications 0.1.3

HTML5 Notifications API for ASP.NET Core Blazor.

Install-Package Blazor.Extensions.Notifications -Version 0.1.3
dotnet add package Blazor.Extensions.Notifications --version 0.1.3
<PackageReference Include="Blazor.Extensions.Notifications" Version="0.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Blazor.Extensions.Notifications --version 0.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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:

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:

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.1.3 378 5/1/2019
0.1.2 1,537 11/26/2018
0.1.0 201 10/30/2018