Git Product home page Git Product logo

react-web-notification's Introduction

React-web-notification Build Status npm version

React component with HTML5 Web Notification API. This component show nothing in dom element, but trigger HTML5 Web Notification API with render method in the life cycle of React.js.

Demo

View Demo

Installation

npm install --save react-web-notification

API

Notification

React component which wrap web-notification.

Props

Notification.propTypes = {
  ignore: bool,
  disableActiveWindow: bool,
  notSupported: func,
  onPermissionGranted: func,
  onPermissionDenied: func,
  onShow: func,
  onClick: func,
  onClose: func,
  onError: func,
  timeout: number,
  title: string.isRequired,
  options: object
};
  • ignore : if true, nothing will be happen

  • disableActiveWindow : if true, nothing will be happen when window is active

  • askAgain : if true, window.Notification.requestPermission will be called on componentDidMount, even if it was denied before,

  • notSupported() : Called when HTML5 Web Notification API is not supported.

  • onPermissionGranted() : Called when permission granted.

  • onPermissionDenied() : Called when permission denied. Notification will do nothing until permission granted again.

  • onShow(e, tag) : Called when Desktop notification is shown.

  • onClick(e, tag) : Called when Desktop notification is clicked.

  • onClose(e, tag) : Called when Desktop notification is closed.

  • onError(e, tag) : Called when Desktop notification happen error.

  • timeout : milli sec to close notification automatically.(Default 5000)

  • title : Notification title.

  • options : Notification options. set body, tag, icon here. See also (https://developer.mozilla.org/en-US/docs/Web/API/Notification/Notification)

Usage example

See example

npm install
npm run start:example

Tests

npm test

Known Issues

react-web-notification's People

Contributors

georgeosddev avatar alexnisnevich avatar yanivkalfa avatar emirotin avatar jfsiii avatar

Watchers

James Cloos avatar Zbigniew Majewski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.