Skip to content

Instantly share code, notes, and snippets.

@alexisljn
Last active March 27, 2021 14:21
Show Gist options
  • Save alexisljn/403902767346e79c488ad8798617eef0 to your computer and use it in GitHub Desktop.
Save alexisljn/403902767346e79c488ad8798617eef0 to your computer and use it in GitHub Desktop.
timeleft from SetTimeout in NodeJS
const timeout = setTimeout(() => {
console.log("executé après 5 sec")
},5000)
setTimeout(() => {
console.log(Math.ceil((timeout._idleStart + timeout._idleTimeout)/1000 - process.uptime()));
}, 3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment