Skip to content

Commit 3e33833

Browse files
committed
Small cleanup before nuget
1 parent e0ea35d commit 3e33833

File tree

6 files changed

+56
-38
lines changed

6 files changed

+56
-38
lines changed

.vsts-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ steps:
2828
- task: NuGetCommand@2
2929
inputs:
3030
command: push
31-
packagesToPush: '$(build.artifactStagingDirectory)/*.nupkg'
31+
packagesToPush: '$(build.ArtifactStagingDirectory)/**/*.nupkg;!$(build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
3232
publishFeedCredentials: 'BlazorExtensions'
3333
nuGetFeedType: external
3434
versioningScheme: byEnvVar

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
# Notifications
2-
Implementation of the [Notification API](https://developer.mozilla.org/en-US/docs/Web/API/notification) in C# for [Blazor](https://github.com/aspnet/Blazor) via Interop.
2+
Implementation of the [Notification API](https://developer.mozilla.org/en-US/docs/Web/API/notification) in C# for [Microsoft Blazor](https://github.com/aspnet/Blazor).
33

4-
## Demo
5-
There is a sample application in /tests/ folder
6-
For some other references of what the API does see the example [demo](https://web-push-book.gauntface.com/demos/notification-examples/)
4+
[![Build status](https://dotnet-ci.visualstudio.com/DotnetCI/_apis/build/status/Blazor-Extensions-Notifications-CI?branch=master)](https://dotnet-ci.visualstudio.com/DotnetCI/_build/latest?definitionId=8&branch=master)
5+
[![Package Version](https://img.shields.io/nuget/v/Blazor.Extensions.Notifications.svg)](https://www.nuget.org/packages/Blazor.Extensions.Notifications)
6+
[![NuGet Downloads](https://img.shields.io/nuget/dt/Blazor.Extensions.Notifications.svg)](https://www.nuget.org/packages/Blazor.Extensions.Notifications)
7+
[![License](https://img.shields.io/github/license/BlazorExtensions/Notifications.svg)](https://github.com/BlazorExtensions/Notifications/blob/master/LICENSE)
8+
9+
# Blazor Extensions
10+
11+
Blazor Extensions are a set of packages with the goal of adding useful things to [Blazor](https://blazor.net).
712

813
## Installation
914

10-
Coming Soon (waiting on the nuspec/ci)
15+
```
16+
Install-Package Blazor.Extensions.Notifications
17+
```
18+
19+
## Demo
20+
There is a sample application in /tests/ folder
21+
For some other references of what the API does see the example [demo](https://web-push-book.gauntface.com/demos/notification-examples/)
1122

1223
## Usage
1324

14-
### Add INotificationService via DI
25+
### Add `INotificationService` via DI
1526
> Scoped by default.
1627
```csharp
1728
public void ConfigureServices(IServiceCollection services)
@@ -26,6 +37,14 @@ public void ConfigureServices(IServiceCollection services)
2637
@inject INotificationService NotificationService
2738
```
2839

40+
or
41+
42+
### Injhect on a `BlazorComponent` class:
43+
44+
```c#
45+
[Inject] private INotificationService _notificationService { get; set; }
46+
```
47+
2948
### Create a notification
3049
```csharp
3150
NotificationOptions options = new NotificationOptions
@@ -38,9 +57,24 @@ await NotificationService.CreateAsync(title, options);
3857
```
3958
### Browser Support
4059
```csharp
41-
bool IsSupportedByBrowser = NotificationService.IsSupportedByBrowserAsync;
60+
bool IsSupportedByBrowser = NotificationService.IsSupportedByBrowserAsync();
4261
```
4362
### Request Permission
4463
```csharp
4564
PermissionType permission = await NotificationService.RequestPermissionAsync();
4665
```
66+
67+
# Contributions and feedback
68+
69+
Please feel free to use the component, open issues, fix bugs or provide feedback.
70+
71+
# Contributors
72+
73+
This project is created and maintained by:
74+
75+
- [Benjamin Vertonghen](vertonghenb)
76+
77+
The following people are the maintainers of the Blazor Extensions projects:
78+
79+
- [Attila Hajdrik](https://github.com/attilah)
80+
- [Gutemberg Ribiero](https://github.com/galvesribeiro)

src/Blazor.Extensions.Notifications.JS/dist/blazor.extensions.notifications.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Blazor.Extensions.Notifications.JS/package-lock.json

Lines changed: 7 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Blazor.Extensions.Notifications.JS/src/NotificationService.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ interface INotificationsManager {
44
Create(title: string, options: object): object;
55
}
66

7-
87
export class NotificationsManager implements INotificationsManager {
9-
RequestPermission(): Promise<string> {
8+
public RequestPermission = (): Promise<string> => {
109
return new Promise((resolve, reject) => {
1110
Notification.requestPermission((permission) => {
1211
resolve(permission);
1312
});
1413
});
1514
}
16-
IsSupported(): boolean {
15+
16+
public IsSupported = (): boolean => {
1717
if (("Notification" in window))
1818
return true;
1919
return false;
2020
}
21-
Create(title: string, options: object): object {
21+
22+
public Create = (title: string, options: object): object => {
2223
var note = new Notification(title, options);
2324
return note;
2425
}

src/Blazor.Extensions.Notifications/NotificationService.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ public async Task<PermissionType> RequestPermissionAsync()
3030
}
3131

3232

33-
public Task CreateAsync(string title, NotificationOptions options)
34-
{
35-
return JSRuntime.Current.InvokeAsync<string>(CreateFunctionName, title, options);
36-
}
33+
public Task CreateAsync(string title, NotificationOptions options) => JSRuntime.Current.InvokeAsync<string>(CreateFunctionName, title, options);
3734

3835
public Task CreateAsync(string title, string body, string icon)
3936
{

0 commit comments

Comments
 (0)