1.2.2 • Published 4 years ago

@remusao/badger v1.2.2

Weekly downloads
17
License
MPL-2.0
Repository
github
Last release
4 years ago

@remusao/badger

A high-level abstraction to manipulate browser action badge in extensions

Usage

const { Badge } = require('@remusao/badger');

const badge = new Badge({
  // Optionally customize badge text and background colors.
  badgeTextColor: 'red', // default: 'white'
  badgeBackgroundColor: 'black', // default: 'blue'

  // Icon can be toggled using the `enable()` and `disable()` methods.
  iconDisabled: './path/to/icon-disabled.png',
  iconEnabled: './path/to/icon-enabled.png',
  // NOTE: You can specify an array of images in `iconEnabled` so that badge is
  // animated when the badge text is updated (e.g. when a counter is increased).

  // Throttle updates of badge to reduce CPU usage.
  minimumUpdateLatency: 250, // default: 500
});

badge.incr(0); // increment count for tabId `0`
badge.reset(0); // reset count for tabId `0`
badge.disable(); // disable badge globally
badge.enable(); // enable badge globally (default state)
1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago