JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 702864
  • Score
    100M100P100Q204776F
  • License MIT

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.

Package Exports

  • badgin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (badgin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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). Starting in Chrome 73, the Badging API is available as an origin trial for Windows (7+) and macOS. If you want to know how origin trials work, please check Google's documentation. Since this API is not available everywhere, badgin safely falls back to alternatives:

via Favicon

via Title

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
    color: string
    indicator: string
  }
  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.