notification-count

Keep track of notifications in your title (or somewhere else)

Usage no npm install needed!

<script type="module">
  import notificationCount from 'https://cdn.skypack.dev/notification-count';
</script>

README

notification-count

Lightweight helper to keep track of notifications in your title (or your preferred element).

Demo

visual

browser support

Install

npm install notification-count

Api

var N = require('notification-count');

// create instance
// optional arguments:
// - count = default count
// - el = element to show the notifications, defaults to document.title
// - left = left separator, default to '('
// - right = right separator, default to ')'

var n = new N();

// add 1 or optional argument
n.add();

// subtract 1 or optional argument
n.subtract();

// set a specific value
n.set();

// set the initial value
// which is 0 or the value you chose yourself
n.default();