question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

std/node: Node compatible setTimeout, setInterval

See original GitHub issue

github_iconTop GitHub Comments

1reaction
lucacasonatocommented, Nov 22, 2021

I’d say it is probably safe to override them in compat mode, if Symbo.toPrimitive is implemented on the timers object. Very ugly though (and very painful). See responses to https://twitter.com/lcasdev/status/1462766579196862470

0reactions
bnoordhuiscommented, Nov 24, 2021

Channeling @lucacasonato: idea is to monkey-patch setTimeout/setInterval globals and return objects instead of numbers in --compat mode.

(My recollection was to return objects always but I might be misremembering and I don’t have a strong preference anyway.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scheduling: setTimeout and setInterval
setInterval allows us to run a function repeatedly, starting after the interval of time, then repeating continuously at that interval. These ...
Read more >
Timers in Node JS (setTimeout, setImmediate, setInterval ...
Let's Explore the different timer methods and their use case. Supported Timers Methods. setTimeout; setImmediate; setInterval; process.nextTick ...
Read more >
Timers in Node.js
Just like setTimeout() , setInterval() also returns a Timeout object which can be used to reference and modify the interval that was set....
Read more >
TypeScript - use correct version of setTimeout (node vs window)
setTimeout which will break if you run the code on nodeJS server (eg. server-side rendered page). Good news, this is also compatible with...
Read more >
setInterval() - Web APIs - MDN Web Docs
It may be helpful to be aware that setInterval() and setTimeout() share the same pool of IDs, and that clearInterval() and clearTimeout() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found