https://github.com/cdaringe/coins-notify
show notifications via the browser. uses os native notifications with jQuery notifyjs fallback
https://github.com/cdaringe/coins-notify
Last synced: about 1 month ago
JSON representation
show notifications via the browser. uses os native notifications with jQuery notifyjs fallback
- Host: GitHub
- URL: https://github.com/cdaringe/coins-notify
- Owner: cdaringe
- Created: 2015-05-16T03:28:58.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:29:09.000Z (over 2 years ago)
- Last Synced: 2025-02-18T06:08:46.453Z (over 1 year ago)
- Language: JavaScript
- Size: 265 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[ ](https://codeship.com/projects/80303)
# coins-notify
show notifications in the browser. attempts to use 'growl' like notifications first, but falls back on notifyjs (jQuery plugin) if the browser user has not accepted (or has denied) growl like notifications.
# usage
Note: if jQuery fallback is being used, jQuery && [notifyjs](http://notifyjs.com/) must be loaded onto the window. This module does **not** address those dependencies.
```js
var Notify = require('coins-notify');
var notifier = new Notifier();
// show a notification
notifier.push({
body: 'test!',
className: 'info'
});
```
###### default, os/growl mode

###### fallback mode

# api
## Notify(opts) [constructor]
### opts
*type: object*
- `maxQueue` *number* number of messages to internally retain history over. not persistent accross browser sessions. See `notifyInstance.queue` for history
## push(opts)
### opts
*type: object*
- `body`* *string* text shown in notification body
- `className` *string* class name applied. Supported classNames are those supported in [notifyjs](http://notifyjs.com/) (alt mode only)
- `alt`/`alternative`/`fallback` *boolean* force the notifier to use the notifyjs fallback
- `icon` *string* absolute url to icon (default mode only)
- `tag` *string* tag!
- `timeout` *number* ms [default, 5000], duration for notification to stay up
- `notifyShow` *function* callback
- `notifyClose` *function* callback
- `notifyClick` *function* callback
- `notifyError` *function* callback
# changelog
- 1.1.5 - improve fallback mode