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

badgin

v1.2.3

Published

Badgin makes it easy to subtly notify the user that there is some new activity that might require their attention, or it can be used to indicate a small amount of information, such as an unread count.

Downloads

568,795

Readme

Badgin

The Badging API is a new web platform API that allows installed web apps to set an application-wide badge, shown in an operating-system-specific place associated with the application (such as the shelf or home screen). The Badging API works on Windows, and macOS, in Chrome 81 or later. It has also been confirmed to work on Edge 84 or later. Support for Chrome OS is in development and will be available in a future release of Chrome. On Android, the Badging API is not supported. Instead, Android automatically shows a badge on app icon for the installed web app when there is an unread notification, just as for Android apps. Since this API is not available everywhere, badgin safely falls back to alternatives.

via badge

Currently, the native badge is only displayed if you install the web application to your home screen (view prerequisites). The screenshot shows the application in the dock of macOS.

via favicon

If the native badge is not available, the favicon will be used and a small badge will be added.

via title

If the favicon is not available, the badge will be added as a prefix to the title.

Demo

You can find a demo at https://jaulz.github.io/badgin/ where you can see the different options. If you want to see the native badge, you need to install the app to your home screen (check out the plus icon in the address bar).

Installation

The module can be installed by running:

yarn add --save badgin

Usage

Just use the library as following:

import badgin from 'badgin'

badgin.set(1) // set value
badgin.set() // set indicator only
badgin.clear()

Options

The following options can be used:

{
  method: 'Badging' | 'Favicon' | 'Title'
  favicon: {
    backgroundColor: string = '#424242'
    color: string = '#ffffff'
    indicator: string = '!'
    radius: number = 3
    size: number = 7
    horizontalMargin: number = 0
    verticalMargin: number = 0
    horizontalPadding: number = 1
    verticalPadding: number = 1
  }
  title: {
    indicator: string = '!'
  }
}

And you can use it like this:

badgin.set(1, {
  favicon: {
    width: 9,
    background: '#549A2F',
  },
})

License / Credits

MIT

This is a refactored fork of the original Tinycon library, Tinycon is released under the MIT license. Tinycon was inspired by Notificon.