We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try executing the below code and it does not work. Seems like there is a issue with setTimeout
var debounce = function (fn, t) { let timerID; return function (...args) { clearTimeout(timerID); timerID = setTimeout(() => { fn.apply(this, args); }, t) } };
const log = debounce(console.log, 100); log('Hello'); // cancelled log('Hello'); // cancelled log('Hello'); // Logged at t=100ms
The text was updated successfully, but these errors were encountered:
The issue may be due to setTimeout not being implemented correctly and console.log being overwritten in the worker to capture logs.
Sorry, something went wrong.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Try executing the below code and it does not work. Seems like there is a issue with setTimeout
var debounce = function (fn, t) {
let timerID;
return function (...args) {
clearTimeout(timerID);
timerID = setTimeout(() => {
fn.apply(this, args);
}, t)
}
};
const log = debounce(console.log, 100);
log('Hello'); // cancelled
log('Hello'); // cancelled
log('Hello'); // Logged at t=100ms
The text was updated successfully, but these errors were encountered: