Giter Club home page Giter Club logo

html5-desktop-notifications's Introduction

Build Status CircleCI

HTML 5 Desktop Notification

Support

  • IE 9+
  • Edge
  • Firefox 22+
  • Google Chrome 32+

Notes

  • [IE 9][IE 10] Does not support Promise. Polyfill required.

  • [MS Edge] Notifications supported for the latest version of Edge that comes with Windows 10 Anniversary Update

  • [Safari] Icon is not displayed - it uses the application icon instance of provided one

  • Have to type of icons - one image format that will be displayed for Chrome/Safari/Firefox and one in .ico format, 16x16 for IE The library automatically will parse the icon name and will add .ico extension if it is not .ico

    The icon resource file must contain a 16x16 icon at 96 dots per inch (dpi). If an icon overlay is already applied, the existing overlay is replaced. Note To view the icon overlay, the taskbar buttons must be in their default large icon mode. Small taskbar icons do not support icon overlays.

  • The Notification constructor(window.Notification) is replaced with custom one in order to polyill the missing properties/methods. Each instance created with new Notification('title') returns the original Notification object(for Chrome/Opera/Firefox/Safari/Edge) and custom Notification object for not supported browsers:

var n = new Notification('title'); n instanceOf Notification; // false for Chrome/Safari/Opera/Edge/Firefox as created notification is instance of the browsers' native Notification object, but window.Notification is a polyfill class.

Permissions

Notification API defines 3 permission levels for supported environments:

  • default - This is equivalent to "denied", but the user has made no explicit choice thus far.
  • granted - This means notifications can be displayed.
  • denied - This means the user does not want notifications.

To support environments that do not implement Notification API, this code implements an additional permission level:

  • notsupported - Notification API is not supported in any format(WHATWG spec or prefixed). Notification could not be displayed. Any Notification API code execution will pass, but no notification will be displayed.

Usage: Use the Standard API for working with this notification library:

TODO

  • Home page - documentation & demo
  • [IE] Add support for event listeners
  • [IE] Implement actions as a thumbBar buttons
  • Add Support for Service Workers

html5-desktop-notifications's People

Contributors

lfilho avatar malept avatar ttsvetko avatar zxuwen avatar

Watchers

 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.