https://github.com/nstr/re-notifier
Redux notifier with using standard web HTML5 API for browser notification
https://github.com/nstr/re-notifier
browser-notifications notifier react-notifications redex-notification redux-notifier web-notifications
Last synced: 3 months ago
JSON representation
Redux notifier with using standard web HTML5 API for browser notification
- Host: GitHub
- URL: https://github.com/nstr/re-notifier
- Owner: nstr
- License: mit
- Created: 2017-03-23T11:45:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-03T13:49:14.000Z (about 8 years ago)
- Last Synced: 2025-02-20T15:40:55.620Z (3 months ago)
- Topics: browser-notifications, notifier, react-notifications, redex-notification, redux-notifier, web-notifications
- Language: JavaScript
- Size: 15.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# re-notifier
Redux notifier with using standard web HTML5 API for browser notification## Installation
```
npm i re-notifier --save
```## Usage
First step: Add re-notifier to your redux reducers.
```js
import { combineReducers } from "redux";import { renotifierReducer } from "re-notifier";
const reducers = combineReducers({
...
renotifier: renotifierReducer
...
});export default reducers;
```Next step: You must get a permission. Ask user about access to his browser notification.
```jsx
import { getPermission } from "re-notifier";class SomeComponent extends React.Component{
...
componentDidMount() {
this.props.dispatch(getPermission());
}
...
}
```After all, you will get the opportunity to send browser notification using re-notifier actions in the way:
```jsx
import { sendNotification } from "re-notifier";this.props.dispatch(sendNotification({
title: "This is a title",
options: {
body: "this is a description"
},
onclick: function() { console.log("a user made click to the notification") }
}));```
Module "re-notifier" serve all web HTML5 API standards.Property | Type | Description
:---|:---|:---
title | `string` (required) | A title of the notication.
options | `Object` | Notification items such as `body`, `icon`, `tag` and etc.
onclick | `function` | Function which was called after click.
closeOnclick | `bool` | Close the notification after click.