timers
Use node:timers
↗ APIs to schedule functions to be executed later.
This includes setTimeout
↗ for calling a function after a delay,
setInterval
↗ for calling a function repeatedly,
and setImmediate
↗ for calling a function in the next iteration of the event loop.
import timers from "node:timers";
console.log("first");timers.setTimeout(() => { console.log("last");}, 10);
timers.setTimeout(() => { console.log("next");});
import timers from "node:timers";
console.log("first");timers.setTimeout(() => { console.log("last");}, 10);
timers.setTimeout(() => { console.log("next");});
The full node:timers
API is documented in the Node.js documentation for node:timers
↗.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark