0.1.7 • Published 2 years ago

favicon-notify v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 namePossible valuesDescriptionDefault value
faviconUrlstringSpecify url to a favicon./favicon.ico
labelColorstringLabel color#FF0000
labelSizenumberLabel size as a percentage of favicon width.70
labelOffsetnumberLabel offset as a percentage of favicon width.5
textColorstringText color on a label#ffffff
fontSizenumberFont size as a percentage of Label size80
fontFamilystringFont for a text on labelArial
fontWeightstringOne of the following values '100', '200', '300', '400' , '500', '600', '700', '800', '900', 'normal', 'bold'bold
fontStylestringOne of the following values - 'normal', 'italic'normal
fontVOffsetnumberOffset to align different fonts vertically. Acceptable values are from -10 to 10. The default value for the Arial font is 4.4
withCounterbooleanWith or without a countertrue
startCounterValuenumberInitial value of a counter0
0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago