Gathering detailed insights and metrics for debounce
Gathering detailed insights and metrics for debounce
Gathering detailed insights and metrics for debounce
Gathering detailed insights and metrics for debounce
Delay function calls until a set time elapses after the last invocation
npm install debounce
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
803 Stars
55 Commits
80 Forks
11 Watching
1 Branches
17 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-2.7%
1,573,794
Compared to previous day
Last week
2.7%
8,256,979
Compared to previous week
Last month
14.6%
34,030,239
Compared to previous month
Last year
72.3%
324,905,016
Compared to previous year
Delay function calls until a set time elapses after the last invocation
1npm install debounce
1import debounce from 'debounce'; 2 3function resize() { 4 console.log('height', window.innerHeight); 5 console.log('width', window.innerWidth); 6} 7 8window.onresize = debounce(resize, 200);
(You can also use const debounce = require('debounce')
)
To check if the debounce delay is currently active:
1window.onresize.isPending;
To later clear the timer and cancel currently scheduled executions:
1window.onresize.clear();
To execute immediately only if you have scheduled invocations and reset the timer:
1window.onresize.flush();
To execute immediately and reset the timer if it was previously set:
1window.onresize.trigger();
Creates a debounced function that delays execution until wait
milliseconds have passed since its last invocation.
Set the immediate
option to true
to execute the function immediately at the start of the wait
interval, preventing issues such as double-clicks on a button.
The returned function has the following methods:
.isPending
indicates whether the debounce delay is currently active..clear()
cancels any scheduled executions..flush()
if an execution is scheduled then it will be immediately executed and the timer will be cleared..trigger()
executes the function immediately and clears the timer if it was previously set.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 11/27 approved changesets -- score normalized to 4
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More