Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
js-confetti
Advanced tools
JS Confetti library with zero dependencies, works without any config, TS typings included, adapts to user screen
💥 Supports emojis as confetti
⚡️ Zero dependencies used
🦄 Works without any config, yet configurable
🛠 Has TypeScript typings
🧩 Confetti speed adapts to user screen width
You can install library from NPM using yarn or npm
yarn add js-confetti
Alternatively you can download script from CDN
<script src="https://cdn.jsdelivr.net/npm/js-confetti@latest/dist/js-confetti.browser.js"></script>
and then access JSConfetti
global variable
Initialize instance of JSConfetti class and call addConfetti method
import JSConfetti from 'js-confetti'
const jsConfetti = new JSConfetti()
jsConfetti.addConfetti()
NOTE new JSConfetti()
creates HTML Canvas element and adds it to page, so call it only once!
If need to use custom canvas element, you can pass canvas
arg to JSConfetti constructor (example)
const canvas = document.getElementById('your_custom_canvas_id')
const jsConfetti = new JSConfetti({ canvas })
Use emojis as confetti:
jsConfetti.addConfetti({
emojis: ['🌈', '⚡️', '💥', '✨', '💫', '🌸'],
})
Customize confetti colors:
jsConfetti.addConfetti({
confettiColors: [
'#ff0a54', '#ff477e', '#ff7096', '#ff85a1', '#fbb1bd', '#f9bec7',
],
})
Customize confetti radius:
jsConfetti.addConfetti({
confettiRadius: 6,
})
Customize confetti number:
jsConfetti.addConfetti({
confettiRadius: 6,
confettiNumber: 500,
})
Combine different properties:
jsConfetti.addConfetti({
emojis: ['🦄'],
emojiSize: 100,
confettiNumber: 30,
})
Call clearCanvas
method to clear canvas
Example:
const jsConfetti = new JSConfetti()
jsConfetti.addConfetti()
// ...
jsConfetti.clearCanvas()
addConfetti
method returns Promise, which is resolved when added confetti dissapears from the user screen due to the gravity physics of confetti
Example:
// async/await
await jsConfetti.addConfetti()
console.log('Confetti animation completed!')
// Promise.then
jsConfetti.addConfetti()
.then(() => console.log('Confetti animation completed!'))
Install dependencies by Yarn or NPM
yarn install
Run dev
script with website build
yarn run dev
MIT
FAQs
JS Confetti library with zero dependencies, works without any config, TS typings included, adapts to user screen
The npm package js-confetti receives a total of 46,635 weekly downloads. As such, js-confetti popularity was classified as popular.
We found that js-confetti demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.