Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@cdellacqua/debounce
Advanced tools
Readme
npm install @cdellacqua/debounce
import {debounce} from '@cdellacqua/debounce';
// It uses requestAnimationFrame by default
const debounced = debounce(() => {
console.log(`Debounced with requestAnimationFrame: ${window.innerWidth}px x ${window.innerHeight}px`);
});
// It preserves function parameters
const debounced = debounce((a, b) => {
console.log(`Debounced with requestAnimationFrame: ${a} and ${b} were passed`);
});
debounced("hello", "test argument");
// The interval can be customized, in this case setTimeout is used
const debounced = debounce(() => {
console.log(`Debounced 1 second: ${window.innerWidth}px x ${window.innerHeight}px`);
}, 1000);
// Passing true as the third arguments makes the function call happen at the start
// of the interval: call then wait instead of wait then call
const debounced = debounce(() => {
console.log(`Debounced 1 second: ${window.innerWidth}px x ${window.innerHeight}px`);
}, 1000, true);
// You can cancel or flush (call+cancel) the next scheduled execution
debounced.flush();
// ..or...
debounced.cancel();
// It exposes a state$ store containing 'idle' or 'debouncing'
const debounced = debounce(() => {
console.log(`Debounced 1 second: ${window.innerWidth}px x ${window.innerHeight}px`);
}, 1000, true);
console.log(debounced.state$.content()); // 'idle'
debounced();
console.log(debounced.state$.content()); // 'debouncing'
// ...after 1000ms
debounced.state$.subscribe(console.log); // immediately prints 'idle'
debounced(); // triggers the subscription, printing 'debouncing'
// ...after 1000ms
// triggers the subscription, printing 'idle'
FAQs
Debounce a function with requestAnimationFrame or a custom interval
The npm package @cdellacqua/debounce receives a total of 15 weekly downloads. As such, @cdellacqua/debounce popularity was classified as not popular.
We found that @cdellacqua/debounce demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.