# nw-notifications

> A node module for sending notifications in nw applications.

Latest version **0.5.0** (published 2017-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install nw-notifications
pnpm add nw-notifications
yarn add nw-notifications
bun add nw-notifications
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2017-11-06 |
| First published | 2017-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | pansinm |
| Maintainers | pansinm |
| Keywords | nw, nwjs, notify, notification |

## Links

- npm: https://www.npmjs.com/package/nw-notifications
- Repository: https://github.com/Casstime/nw-notifications
- Homepage: https://github.com/Casstime/nw-notifications#readme
- Issues: https://github.com/Casstime/nw-notifications/issues
- npm.io page: https://npm.io/package/nw-notifications

## Dependencies (1)

- [uuid](https://npm.io/package/uuid.md) ^3.0.1

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2017-11-06
- 0.4.2 — 2017-08-14
- 0.4.1 — 2017-08-14
- 0.4.0 — 2017-08-14
- 0.3.0 — 2017-07-10
- 0.2.0 — 2017-06-23
- 0.1.2 — 2017-05-17
- 0.1.1 — 2017-05-05
- 0.1.0 — 2017-04-25

## README

# nw-notifications
A node module for sending notifications in nw applications.

### Install
```
npm install nw-notifications
```

### Usage

#### Notifications.create(options)

More displayOptions see [NotificationOptions](https://developer.chrome.com/extensions/notifications#type-NotificationOptions)

```javascript
var Notifications = require('nw-notifications');
var notification = Notifications.create({
  iconUrl: 'icon.png',
  title: 'title',
  message: 'message'
});
```

#### Notifications.setDefaultOptions(options)


```javascript
Notifications.setDefaultOptions({
  iconUrl: 'icon.png'
});
```

#### Notifications.setDisplayTime(delay)
```javascript
Notification.setDisplayTime(20000); // notification will closed 20s later;
```

### Notifications.setLogger(logger)
Default logger is console

### Notifications.clear()
Clear all notifications 

### events

```
notification.on('shown', function () {
  // displayed
});

notification.on('clicked', function () {
  // clicked message body
});

notification.on('closed', function (reason) {
  console.log(reason); 
  // CLOSED_BY_USER
  // CLOSED_BY_TIMEOUT
  // CLOSED_BY_CLICK
});

```

---
_Source: https://npm.io/package/nw-notifications · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
