Minimal ES6 Native Web Notification Library

Category: Javascript , Notification | March 4, 2017
Author:tijnrenders
Views Total:271 views
Official Page:Go to website
Last Update:March 4, 2017
License:MIT

Preview:

Minimal ES6 Native Web Notification Library

Description:

A lightweight ES 5/6 library for displaying native web notifications with custom contents & icons in your browsers.

Install it via NPM:

# NPM
$ npm install web-notifications

How to use it:

Import the library into your web project.

<script src="web-notifications.js"></script>

Get the browser permission for the native notifications.

wn.getPermission()

Send a default notification to your users.

wn.send('Sample Text')

Send a notification with custom title, content, icon, event function:

wn.send('Title', 'Body Content', 'Icon Path', function(){
  // do something
});

You Might Be Interested In:


Leave a Reply