# browser-notification-for-web-app

> A lite package to display desktop notification for web application.

Latest version **1.0.5** (published 2020-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install browser-notification-for-web-app
pnpm add browser-notification-for-web-app
yarn add browser-notification-for-web-app
bun add browser-notification-for-web-app
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2020-08-10 |
| First published | 2020-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Zhen YAN |
| Maintainers | zhen_yan |
| Keywords | notification, desktop, browser |

## Links

- npm: https://www.npmjs.com/package/browser-notification-for-web-app
- Repository: https://github.com/William-Zhen-YAN/browser-notification
- Homepage: https://github.com/William-Zhen-YAN/browser-notification#readme
- Issues: https://github.com/William-Zhen-YAN/browser-notification/issues
- npm.io page: https://npm.io/package/browser-notification-for-web-app

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.19
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.159

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2020-08-10
- 1.0.4 — 2020-08-10
- 1.0.3 — 2020-08-10
- 1.0.2 — 2020-08-10
- 1.0.1 — 2020-08-10
- 1.0.0 — 2020-08-10

## README

# browser-notification

A lite package to display desktop notification for web application.

## On starting the app

Check if permission has been granted. If not, show a dialogue to ask for user's choice.

example:

```
const hasPermission = await BrowserNotification.askPermission();
if (hasPermission) {
    // do something if permission has been granted.
} else {
    // do something to ask for permission
}
```

## On showing notification

### 1. Show a small number of notifications

Use this when you have a small number of notifications to show.

example:

```
BrowserNotification.notify({
    title: 'title',
    message: 'message',
    icon:'path of icon'});
```

### 2. Show a large number of notifications

Use this when you have a large number of notifications to show.

example:

```
BrowserNotification.debounceNotify({
    title: 'title',
    message: 'message',
    icon:'path of icon'});
```

## Constraints

- This will not work in a http environment.
- Only show the latest notification when a large amount of notifications are received concurrently.

---
_Source: https://npm.io/package/browser-notification-for-web-app · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
