npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

web-notifications

v1.1.4

Published

A wrapper for using the Web Notifications API

Downloads

16

Readme

web-notifications (QBNotification)

Overview

A wrapper for using the Web Notifications API.

See it in action in folder test

Browsers support see on caniuse

Install

Install the package via CDN

https://cdn.rawgit.com/QuickBlox/web-notifications/master/qbNotification.js

or as NPM package

npm i web-notifications --save-dev

or as Bower component

bower i web-notifications --save-dev

Usage

Module is written like Universal Module Definition, so use everywhere.

Before show a notification you need to get permission from a user by

QBNotification.requestPermission(function(state) {
    console.log('State is changed: ' + state);
});

Then you should create instance of QBNotification.

/**
 * @param {[string]} title [Title of notification. Required.]
 * @param {[type]} options [Additional options: standard params + timeout]
 */
var notify = new QBNotification(title, options);

Example options

var options = {
    body: 'Body of notification',
    tag: 'chatQB',
    icons: 'image/icons.png',
    timeout: 7,
    closeOnClick: true
}

Then you can show notification via

notify.show()

Also you have:

/**
 * [isSupported - check whether Notification API available in environment or not]
 * @return {Boolean} [flag]
 */
QBNotification.isSupported()
/**
 * [needsPermission - check whether a user provided his permission to show notifications or not]
 * @return {Boolean} [flag]
 */
QBNotification.needsPermission()

Contribution

For test we use JSHint, so do

npm install -g jshint
npm test

before push yours changes.

Helpful links

W3, whatwg group, MDN

License

BSD