Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deebloo/web-notification
Vanilla Web Component for the HTML5 Notifications API
https://github.com/deebloo/web-notification
Last synced: about 2 months ago
JSON representation
Vanilla Web Component for the HTML5 Notifications API
- Host: GitHub
- URL: https://github.com/deebloo/web-notification
- Owner: deebloo
- License: mit
- Created: 2016-02-14T20:16:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T05:36:38.000Z (about 1 year ago)
- Last Synced: 2024-11-01T11:51:34.325Z (2 months ago)
- Language: JavaScript
- Size: 213 KB
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# web-notification
Vanilla Web Component for the HTML5 Notifications API. [Demo](http://deebloo.github.io/web-notification/)##### Installation
```
npm i --save web-notificationbower install --save web-notification
```#### Properties
| Name | Description |
| -------------- | ------------- |
| title | The title of the notification |
| body | body of the notification |
| icon | the icon to display with the notification |
| timeout | amount of time to display notifcation before auto hiding |
| notify-on-load | trigger notification as soon as the component is created |#### API
| Name | Description |
| --------- | ------------- |
| .notify() | Manually triggers the notification |#### Example
```HTML
document.getElementById('notificationEl1').notify();
```
#### Dynamic
To dnyamically add new notification elements.
```JS
var createWebNotification = require('web-notification'); // or available by 'createWebNotification' on window if not using modulesvar myNotification = createWebNotification({
title: 'My Title',
body: 'My Body'
});document.appendElement(myNotification);
```