Skip to content

custom debug function not getting logged. #4

New issue

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

Open
sampath-E1005112 opened this issue Mar 20, 2025 · 1 comment
Open

custom debug function not getting logged. #4

sampath-E1005112 opened this issue Mar 20, 2025 · 1 comment

Comments

@sampath-E1005112
Copy link

sampath-E1005112 commented Mar 20, 2025

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

@acbcdev
Copy link
Owner

acbcdev commented Mar 20, 2025

The issue may be due to setTimeout not being implemented correctly and console.log being overwritten in the worker to capture logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants