• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web Notifications Powered by RxJS for Angular

@ngrx/notify

Web Notifications Powered by RxJS for Angular 2

Join the chat at https://gitter.im/ngrx/notify

Easily create and handle desktop notifications in Angular 2

Installation

Install @ngrx/notify from npm:

npm install @ngrx/notify --save

Setup the providers, optionally providing global notification options:

import { NOTIFY_PROVIDERS, NOTIFY_GLOBAL_OPTIONS } from '@ngrx/notify';

bootstrap(App, [
  NOTIFY_PROVIDERS,
  { provide: NOTIFY_GLOBAL_OPTIONS, multi: true, useValue: { /* global options here */ } }
])

Usage

Requesting Notification Permission

Before creating notifications, you must resolve the app's notification permission:

class AppComponent {
  constructor(notify: Notify) {
    notify.requestPermission().subscribe(permission => {
      if (permission) {
        // continue
      }
    });
  }
}

Creating a Notification

To create a notification observable, call the open() method with a title and optional config. The notification will be opened when you subscribe to the observable and will close after you unsubscribe from it. The observable will emit the instance of the notification every time it is clicked on:

notify.open('Hello world!', options)
  // Automatically close the notification after 5 seconds
  .takeUntil(Observable.timer(5000))
  // Close the notification after it has been clicked once
  .take(1)
  .subscribe(notification => {

  });

See the documentation on MDN for available options.

More Repositories

1

platform

Reactive State for Angular
TypeScript
7,986
star
2

store

RxJS powered state management for Angular applications, inspired by Redux
TypeScript
3,908
star
3

example-app

Example app showcasing the ngrx platform
TypeScript
1,362
star
4

effects

Side effect model for @ngrx/store
TypeScript
532
star
5

store-devtools

Developer Tools for @ngrx/store
TypeScript
326
star
6

router

Reactive Router for Angular
TypeScript
269
star
7

db

RxJS powered IndexedDB for Angular apps
TypeScript
186
star
8

router-store

Bindings to connect the Angular Router to @ngrx/store
TypeScript
182
star
9

ngrx.github.io

Reactive Extensions for Angular
HTML
114
star
10

core

Core functionality for the ngrx platform
TypeScript
72
star
11

store-log-monitor

Log Monitor for @ngrx/store-devtools and Angular
TypeScript
63
star
12

signal-store-workshop

Source Code for NgRx SignalStore Workshop
TypeScript
29
star
13

store-builds

@ngrx/store build artifacts
JavaScript
16
star
14

store-devtools-builds

@ngrx/store-devtools build artifacts
JavaScript
10
star
15

entity-builds

@ngrx/entity build artifacts
JavaScript
8
star
16

component-store-builds

@ngrx/component-store build artifacts
JavaScript
6
star
17

angular

TypeScript
5
star
18

signals-builds

JavaScript
4
star
19

schematics-builds

@ngrx/schematics build artifacts
4
star
20

ngrx-io-builds

ngrx.io builds
HTML
4
star
21

router-store-builds

@ngrx/router-store build artifacts
JavaScript
2
star
22

ngrx-io-previews

ngrx.io preview builds
HTML
1
star
23

ngrx-modules-workshop

NgRx Global store workshop - module-based application
TypeScript
1
star
24

signal-store-starter

Stackblitz Project for the SignalStore
TypeScript
1
star
25

ngrx-standalone-workshop

TypeScript
1
star
26

data-builds

@ngrx/data build artifacts
JavaScript
1
star
27

effects-builds

@ngrx/effects build artifacts
JavaScript
1
star