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

aud-notifier

v1.0.9

Published

AUD Notifier is JS Library to access Javascript Notification Easily With Many Features

Downloads

4

Readme

AUDNotifier

AUDNotifier is Javascript Library make use browser notification easily

Features

  • Send Notification according to Mobile or Desktop

  • Set Audio when Notification fires

Installation

npm install aud-notifier

use notify init to add Notifier Service Worker file to your public path

sendNotification

you can send notification using sendNotification methods

AUDNotifier.sendNotification(title,options)

// send notification on desktop only
AUDNotifier.sendDesktopNotification(title,options)

// send notification on mobile only
AUDNotifier.sendMobileNotification(title,options)

sendNotificationRepeatedly

you can send notification using sendNotificationRepeatedly methods

AUDNotifier.sendNotificationRepeatedly(title,options,numberOfRepeats=1,repeatAfter=1000)
/*
send using set of times
the example below first repeat will fire after 2000 ms from send notification
and second repeat will fire after 1000 ms from first notification
*/
AUDNotifier.sendNotificationRepeatedly(title,options,2,[2000,1000])
// send notification repeatedly on desktop only
AUDNotifier.sendDesktopNotificationRepeatedly(title,options,numberOfRepeats=1,repeatAfter=1000)

// send notification repeatedly on mobile only
AUDNotifier.sendMobileNotificationRepeatedly(title,options,numberOfRepeats=1,repeatAfter=1000)

options

new options you can use

set Audio

set audio when notification fires options.audio supports wav,ogg and mp3

AUDNotifier.sendNotification(title,{
    audio:'audio-source'
})

to control volume

AUDNotifier.sendNotification(title,{
    audio:{
        src:'audio-source',
        volume:0.5 //from 0 to 1
    }
})

Events

AUDNotifier.sendNotification(title,{
    onClick:function(event) {

    },
    onClose:function(event) {

    },
    onShow:function(event) {

    },
    onError:function(event) {

    }
    })

Note: options events doesn't fires if you browser use serviceworker notifications and you don't use library service worker

closeAfter

AUDNotifier.sendNotification(title,{
closeAfter:5000// close notification after 5000ms(5 seconds)
    })

Redirect

AUDNotifier.sendNotification(title,{
redirect:'https://example.com'// go to redirect link on click
    })

Note: options redirect doesn't fires if you browser use serviceworker notifications and you don't use library service worker

close

close notification after send notification

AUDNotifier.sendNotification(title,options).then(notification=>{
    notification.close()
})

close by tag

AUDNotifier.close(tag)

close all

AUDNotifier.clear()

Permission

requestPermission

AUDNotifier.Permission.requestPermission({
    onGranted:function(){}, // run when permission is granted
   onDenied:function(){}, // run when permission is denied
   onDefault:function(){}, // run when permission is default
})

Check Permission

AUDNotifier.Permission.isGranted() // check if permission is granted
AUDNotifier.Permission.isDenied() // check if permission is denied
AUDNotifier.Permission.isDefault() // check if permission is default

Get current permission

AUDNotifier.Permission.get()

Set custom service worker

if the browser send Notification using service worker you can set your service worker using

AUDNotifier.setServiceWorkerSettings({
    file:'file.js',
    scope:'/path'
})

Note: this method doesn't fires if you browser use serviceworker notifications