A light set of helpers for updating title and favicons dynamically.
See examples here
npm i @space-kit/hat
import { setTitleCount } from '@space-kit/hat';
setTitleCount(10) // updates title as `(10) your title text`
import { titleCounter } from '@space-kit/hat';
const increment = titleCounter(0, 'Hello');
increment() // updates title as `(1) your title text`
import { rollingTitle } from '@space-kit/hat';
rollingTitle('A very long text') // start a rolling title
Updates favicon with an svg.
import { svgFavicon } from '@space-kit/hat';
const svgLogo = '<svg>yoursvg</svg>`;
svgFavicon(svgLogo); // set svg icon as favicon
Replaces {{count}}
in an svg with a dynamic counter value, Suitable for chat apps to show unread messages inside favicon.
import { svgFaviconCounter } from '@space-kit/hat';
/**
* Replace {{count}} with counter value
*/
const svgLogo = '<svg>{{count}}</svg>';
const incrementFavicon = svgFaviconCounter(svgString);
incrementFavicon(); // increments count inside favicon
npm run build
npm run test
npm publish