@space-kit/hat
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

HAT

A light set of helpers for updating title and favicons dynamically.

Examples

See examples here

Installation

npm i @space-kit/hat

Helpers

Add a count in title

import { setTitleCount } from '@space-kit/hat';

setTitleCount(10) // updates title as `(10) your title text`  

Add a counter to title

import { titleCounter } from '@space-kit/hat';

const increment = titleCounter(0, 'Hello');

increment() // updates title as `(1) your title text`  

Add a rolling title

import { rollingTitle } from '@space-kit/hat';

rollingTitle('A very long text') // start a rolling title 

Update favicon with an svg

Updates favicon with an svg.

import { svgFavicon } from '@space-kit/hat';

const svgLogo = '<svg>yoursvg</svg>`;

svgFavicon(svgLogo); // set svg icon as favicon

Update favicon with an svg

Replaces {{count}} in an svg with a dynamic counter value, Suitable for chat apps to show unread messages inside favicon.

import { svgFavicon } from '@space-kit/hat';

/**
 * Replace {{count}} with counter value
*/
const svgLogo = '<svg>{{count}}</svg>';

const incrementFavicon = svgFaviconCounter(svgString);

incrementFavicon(); // increments count inside favicon

Development

Build

npm run build

Test

npm run test

Release

npm publish

Readme

Keywords

Package Sidebar

Install

npm i @space-kit/hat

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

10.2 kB

Total Files

6

Last publish

Collaborators

  • mrdevops
  • shamin.meerankutty