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

screamerjs

v1.2.0

Published

Screamer.js is a Vanilla Javascript plugin to provide simple yet fully customisable web notifications using Web Notifications API

Downloads

3

Readme

Screamer.JS

Build Status

Minion using Megaphone

Screamer.js is a Vanilla Javascript plugin to provide simple yet fully customisable web notifications using Web Notifications API.

Demo

screenshot of notifications

If you want to see how it works, take a look at the DEMO.

Installation

  1. Download the zip
  2. Paste the screamer.js at your js assets folder.
  3. If you want to use same images, get them on [https://github.com/willianjusten/screamer-js/tree/master/example] and paste to your img assets folder.

How to Use

CommonJS


var Screamer = require('screamer');
var notification = new Screamer(options);

AMD

define([ 'Screamer' ], function( Screamer ) {
  var notification = new Screamer(options);
});

To create the Notification you have to create a new instance of Screamer, set some options that you wish and use the notify method to start the notification. Take a look at this snippet:


// create an instance of Screamer with some options
var scream = new Screamer({
    'title': 'Success!',
    'body': 'Lorem ipsum dolor sit amet.',
    'icon': 'icon_success.png',
    'fade': 1000
});

// adding an eventListener to call the Notification
var button = document.querySelector('#fade');
button.addEventListener('click', function(){
    scream.notify();
});

You can attach this to different events, like onload, ready or anything else that allows to call the notify method.

Options

  • title (string) - notification title. (REQUIRED)
  • body (string) - notification message.
  • icon (string) - path to the notification icon.
  • tag (string) - unique identifier to stop duplicate notifications.
  • lang (string) - language of the notification. (default: en).
  • timeout (integer) - time in miliseconds to fade the notification.
  • before (function) - A callback function called before show the notification.
  • after (function) - A callback function called before show the notification.

Static Methods

  • Screamer.verifySupport() - Function to test for Web Notifications API browser support.
  • Screamer.checkPermission() - Verify if permission exists, if not, request a permission and verify if granted.

Testing

First of all, install the NodeJS and deppendencies.

npm install

Later, you can run all tests running:

npm test

This should be open a Firefox instance and do a single run of tests.

Run Demo locally

Because the Web Notification require some permissions, you have to run this on a single server. An easy way to run this is:

python -m SimpleHTTPServer

Pay attention if your port is not in use.

Browser Support

This library relies on Web Notifications API. And this API is supported in the following browsers.

Chrome | Firefox | Opera | Safari | IE | --- | --- | --- | --- | --- | 31+ ✔ | 38+ ✔ | 32+ ✔ | 8+ ✔ | Nope ✘ |

Thanks

This project would be nothing without this guys:

License

This plugin is free and open source software, distributed under the The MIT License. So feel free to use this to create notifications for your site without linking back to me or using a disclaimer.

If you’d like to give me credit somewhere on your blog or tweet a shout out to @willian_justen, that would be pretty sweet.