npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

favicon-notify

v0.1.7

Published

Plugin for displaying notifications on the favicon of the site

Downloads

322

Readme

Installation

npm install favicon-notify

Basic usage

import FaviconNotify from 'favicon-notify'
// ...

const faviconNotify = new FaviconNotify({
  // Options
}, /* optional */ link = null )
/***
* link - is link to HTMLLinkElement with a favicon.
* You can specify the url to the favicon in the options
* object, or pass a link to a specific 'link' element
* with your favicon with the second parameter, or do not
* specify anything then the url will be used
* by default - /favicon.ico
*/

/***
 * Executes the passed callback when the Favicon Notify instance is initialized.
 * 
 * @param callback // Callback function
 * @return void
 */
faviconNotify.ready(callback)

/***
 * Add a notification to the favicon
 * If the WithCounter option is enabled (by default is disabled),
 * each subsequent call to this method will increment the counter by one.
 * If the WithCounter option is disabled (by default)
 * the value will not be displayed on the favicon instead,
 * an empty notification will be shown.
 * 
 * @param forceNotCount: boolean // Optional. Leaves the counter value unchanged.
 * @return faviconNotify context
 */
faviconNotify.add(forceNotCount = false)

/***
 * Sets the counter value and add notification from the favicon.
 * If the WithCounter option is enabled (by default is disabled),
 * this action will overwrite the counter current value.
 * If the WithCounter option is disabled (by default)
 * the value will not be displayed on the favicon instead,
 * an empty notification will be shown.
 * 
 * @param value: Number
 * @return faviconNotify context
 */
faviconNotify.setCounter(value)

/***
 * Remove a notification from the favicon.
 * If the "WithСounter" option is enabled (by default is disabled),
 * the counter will be reset to zero.
 * 
 * @param forceNotCount: boolean // Optional. Leaves the counter value unchanged.
 * @return faviconNotify context
 */
faviconNotify.remove(forceNotCount = false)

Options

| Option name | Possible values | Description | Default value | |-------------------|-----------------|------------------------------------------------------------------------------------------------------------------------------|---------------| | faviconUrl | string | Specify url to a favicon. | /favicon.ico | | labelColor | string | Label color | #FF0000 | | labelSize | number | Label size as a percentage of favicon width. | 70 | | labelOffset | number | Label offset as a percentage of favicon width. | 5 | | textColor | string | Text color on a label | #ffffff | | fontSize | number | Font size as a percentage of Label size | 80 | | fontFamily | string | Font for a text on label | Arial | | fontWeight | string | One of the following values '100', '200', '300', '400' , '500', '600', '700', '800', '900', 'normal', 'bold' | bold | | fontStyle | string | One of the following values - 'normal', 'italic' | normal | | fontVOffset | number | Offset to align different fonts vertically. Acceptable values are from -10 to 10. The default value for the Arial font is 4. | 4 | | withCounter | boolean | With or without a counter | true | | startCounterValue | number | Initial value of a counter | 0 |