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

pushjs-notification

v1.0.1

Published

pushjs-notification is a JavaScript based windows/browser notification. This package supports all JavaScript frameworks and libraries.

Downloads

3

Readme

pushjs-notification

pushjs-notification is the fastest way to get up and running with Javascript desktop and mobile notifications. The Notification API allows modern browsers such as Chrome, Safari, Firefox, and IE 9+ to push notifications to a user's desktop.

Installation

Install the plugin using the NPM.

npm install pushjs-notification --save

Basic Implementation

Import the package in your component

import {jsPushNotification} from 'pushjs-notification';
@Component({
    ///
})
export class AppComponent {
    ...
  generateNotification() {
    let jsPush = new jsPushNotification();
	jsPush.NotificationTitle = 'pushjs-notification';
    jsPush.ClickEnable = true;
	jsPush.NavigateUrl = 'https://www.npmjs.com/package/pushjs.notification';
    jsPush.Options.body = 'The plugin supports modern browsers such as Chrome, Safari, Firefox, and IE 9+ to push notifications to a users desktop';
    jsPush.Options.icon = 'favicon.ico';
    jsPush.Options.image = 'bannerImage.ico';
    jsPush.showNotification();
  }
    ...
}

Options

Inputs

  • NotificationTitle string: Defines a title for the notification, which will be shown at the top of the notification window when it is fired.
  • ClickEnable boolean: Specifies whether click event is enabled or not (Default value is false)
  • NavigateUrl string: If the ClickEnable is true, then when the notification is clicked, it will redirect to specified url.
  • Options object: An options object containing any custom settings that you want to apply to the notification.(These are optional settings) The possible options are:
    • dir string: The direction in which to display the notification. It defaults to auto, which just adopts the browser's language setting behavior, but you can override that behaviour by setting values of ltr and rtl (although most browsers seem to ignore these settings.)
    • body string: A DOMString representing the body text of the notification, which will be displayed below the title.
    • tag string: A DOMString representing an identifying tag for the notification.
    • icon string: A USVString containing the URL of an icon to be displayed in the notification.
    • image string: A USVString containing the URL of an image to be displayed in the notification.
    • data string: Arbitrary data that you want associated with the notification. This can be of any data type.
    • vibrate string: A Vibration Pattern for the device's vibration hardware to emit when the notification fires.
    • renotify boolean: A Boolean specifying whether the user should be notified after a new notification replaces an old one. The default is false, which means they won't be notified.
    • requireInteraction boolean: Indicates that a notification should remain active until the user clicks or dismisses it, rather than closing automatically. The default value is false.

API Reference

showNotification() function: Used to generate the notification.

Note: Before calling sendNotification() you need to initialize above specified Input properties for the customization.

Todos

  • Write MORE Tests
  • Add additional features
  • Web Workers compatibility

License

MIT

Free Software, Hell Yeah!