To install tabky-js, run the following command in your terminal.
addBadge(props: Object): void
Adds a badge to the current favicon. This can be used to add "you have a notification" type effect to your favicon or to indicate some other state to the user. Currently resets the favicon when called so you can only add badges to the original favicon.
type
: "dot" | "count"
- Type of badge.count
: number
- Default: null. Count to display on the badge. Only used if type: "count".size
: "xs" | "sm" | "md" | "lg"
- Default: "md". Size of the badge.position
: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center"
- Default: "top-right". Position of the badge on faviconfont
: string
- Default: "sans-serif". Override font used for the count. Only used if type: "count".dotColor
: Color
- Default: "#ff0000". Color of the badge dot. Accepts any valid CSS color.innerDotColor
: Color
- Default: "#fff". Color of the inner badge dot. Accepts any valid CSS color. Set to same as dotColor to remove inner dot. Only used if type: "dot".countColor
: Color
- Default: "#fff". Color of the count / number in badge. Only used if type: "count".swapFavicon(props: Object)
Replace the current favicon with a new one. By using the "when" options prop, you can make it run only once or on blur / focus events (always). Resetting will reset the favicon to the original value before any tampering.
favicon
: string
- The URL or emoji of the new favicon.when
: "now" | "onfocus" | "onblur"
- Default "now". When to swap the favicon.reset
: "none" | "after" | "onfocus" | "onblur"
- Reset the favicon if needed to the original favicon before any tampering.resetAfterMs
: number
- The number of milliseconds to wait before resetting the favicon. Only used with reset: "after"swapTitle(props: Object): void
Replace the current title with a new one. By using the "when" options prop, you can make it run only once or on blur / focus events (always). Resetting will reset the title to the original value before any tampering.
title
: string
- The new document title (document.title).when
: "now" | "onfocus" | "onblur"
- Default "now". When to swap the title.reset
: "none" | "after" | "onfocus" | "onblur"
- Reset the title if needed to the original document title before any tampering.resetAfterMs
: number
- Used only with reset: "after" - The number of milliseconds to wait before resetting the title.resetFavicon(): void
Resets the favicon, undoing any other swapping or messing with the title done by this library.
resetTitle(): void
Resets the title, undoing any other swapping or messing with the title done by this library.
marqueeTitle(props: Object): Interval
Marquee effect on the document title. Not really optimised. Built for fun, usage not recommended.
title
: string
- The new document title to marquee.interval
: number
- Default 300. How fast the title is marquee'd in milliseconds. Used for the setInterval that scrolls the title.