Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

favicon-marquee

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

favicon-marquee - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

16

lib/main.d.ts

@@ -45,2 +45,10 @@ /**

}
/**
* A scrolling favicon for your website.
* How to use:
* 1. Initialize using the constructor
* const faviconMarquee = new FaviconMarquee();
* 2. Call its start method
* faviconMarquee.start();
*/
export declare class FaviconMarquee {

@@ -55,3 +63,2 @@ private readonly size;

private pixelsScrolled;
private redraws;
private interval?;

@@ -63,3 +70,10 @@ private favicon?;

constructor({ text, font, color, step, size, marginBottom, background, }: FaviconMarqueeParameters);
/**
* Start the marquee at 24 FPS. The refresh interval can be configured using the interval parameter.
* Higher FPS may result in performance issues on low-powered devices.
*/
start(interval?: number): void;
/**
* Stop the marquee. It can be restarted again using {@link start}
*/
stop(): void;

@@ -66,0 +80,0 @@ private draw;

25

lib/main.js

@@ -0,1 +1,9 @@

/**
* A scrolling favicon for your website.
* How to use:
* 1. Initialize using the constructor
* const faviconMarquee = new FaviconMarquee();
* 2. Call its start method
* faviconMarquee.start();
*/
export class FaviconMarquee {

@@ -11,5 +19,7 @@ constructor({ text = "SCROLLING TEXT", font = '"Arial", sans-serif', color = "green", step = 0.5, size = 32, marginBottom = 0, background, }) {

this.pixelsScrolled = 0;
this.redraws = 0; // counts how many times the same canvas has been used for drawing the favicon
// needed because Firefox slows down horribly when reusing the same canvas too many times
}
/**
* Start the marquee at 24 FPS. The refresh interval can be configured using the interval parameter.
* Higher FPS may result in performance issues on low-powered devices.
*/
start(interval = 1000 / 24) {

@@ -23,2 +33,5 @@ this.favicon = document.createElement("link");

}
/**
* Stop the marquee. It can be restarted again using {@link start}
*/
stop() {

@@ -29,9 +42,2 @@ clearInterval(this.interval);

draw() {
if (this.redraws === 500) {
// make a new canvas every 500 redraws
// this number is high enough to avoid frequent garbage collection
// but low enough to avoid Firefox performance problems
this.createCanvas();
this.redraws = 0;
}
if (this.ctx === undefined ||

@@ -74,5 +80,4 @@ this.textWidth === undefined ||

this.textWidth = Math.ceil(this.ctx.measureText(this.text).width);
this.redraws++;
}
}
export default FaviconMarquee;
{
"name": "favicon-marquee",
"version": "1.2.1",
"version": "1.2.2",
"description": "An animated scrolling favicon for your website",

@@ -5,0 +5,0 @@ "author": "Sten Laane <sten@laane.xyz> (https://laane.xyz)",

# favicon-marquee
![Scrolling text example 1](https://i.imgur.com/o3f9cWL.gif)
![Scrolling text example 1](./examples/scrolling-example-1.gif)
![Scrolling text example 2](https://i.imgur.com/OFJRjuK.gif)
![Scrolling text example 2](./examples/scrolling-example-2.gif)

@@ -33,3 +33,3 @@ > A <5 kB JavaScript class with no dependencies that adds an animated scrolling

<script type="module">
import FaviconMarquee from "https://cdn.jsdelivr.net/npm/favicon-marquee@1.2.0/lib/main.js";
import FaviconMarquee from "https://cdn.jsdelivr.net/npm/favicon-marquee@1.2.2/lib/main.js";
// ...

@@ -84,3 +84,5 @@ </script>

```
`marquee.stop()` can be used to stop the marquee at any time, after which it can be restarted again with `marquee.start()`.
## Contributing and Issues

@@ -87,0 +89,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc