@approvals-cloud/badgindeprecated

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.

Usage no npm install needed!

<script type="module">
  import approvalsCloudBadgin from 'https://cdn.skypack.dev/@approvals-cloud/badgin';
</script>

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 @approvals-cloud/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.