https://github.com/dbtek/notier
Simple promise enabled wrapper around notification library notie.
https://github.com/dbtek/notier
in-app-notification notie notifications promises
Last synced: 11 months ago
JSON representation
Simple promise enabled wrapper around notification library notie.
- Host: GitHub
- URL: https://github.com/dbtek/notier
- Owner: dbtek
- License: mit
- Created: 2018-02-13T17:23:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-17T07:10:03.000Z (over 7 years ago)
- Last Synced: 2025-06-22T09:47:16.472Z (12 months ago)
- Topics: in-app-notification, notie, notifications, promises
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# notier
Simple promise enabled wrapper around notification library notie.
### Install
```bash
$ npm i -S notier
# or
$ yarn add notier
```
### Use
```js
var notier = require('notier')
// general notifier
notier('Hi there!')
// success type notification
notier.success('Item acquired successfully')
// error type notification
notier.error('Could not find any results!' )
// confirm
notier.confirm('Are you sure? This cannot be undone.')
.then(data => {
// user accepted
})
.catch(() => {
// user rejected
})
```
### API
**notier(message, opts)**
`message` is self explanatory. `opts` is [notie](https://github.com/jaredreich/notie) options. Returns promise.
**notier.info(message, opts)**
Info type notification.
**notier.success(message, opts)**
Success type notification.
**notier.warning(message, opts)**
Warning type notification.
**notier.error(message, opts)**
Error type notification.
**notier.confirm(message, opts)**
Confirm notification. Returned promise will resolve on accept.
**notier.setTexts({ submit, cancel })**
Set global texts to be used in actions.
### Author
Ismail Demirbilek - [@dbtek](https://twitter.com/dbtek)