Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7090211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:01:07+00:00 2026-05-28T08:01:07+00:00

In browsers, if you use setTimeout from within a function called by setTimeout then

  • 0

In browsers, if you use setTimeout from within a function called by setTimeout then a minimum delay of 4ms will be enforced. Mozilla’s developer wiki describes this behaviour, and mentions that it has become standardized in HTML5.

Node.js’s documentation for setTimeout does not mention a minimum delay. However, the documentation for the process.nextTick function describes it as a more efficient alternative to setTimeout(fn, 0). This suggests the possibility that it’s more efficient because it’s avoiding this delay. Otherwise setTimeout(fn, 0) could probably be optimized to behave the same.

Does Node.js enforce a minimum delay for setTimeout, as web browsers do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:01:07+00:00Added an answer on May 28, 2026 at 8:01 am

    It doesn’t have a minimum delay and this is actually a compatibility issue between browsers and node. Timers are completely unspecified in JavaScript (it’s a DOM specification which has no use in Node and isn’t even followed by browsers anyway) and node implements them simply due to how fundamental they’ve been in JavaScript’s history and how irreplaceable they are otherwise.

    Node uses libuv which a cross-platform abstraction layer for lower level system things like file-system, networking stuff, etc. One of those things is timers, which Node provides a minimal wrapper around. At the libuv level, the timers used are the system-specific high precision timers. In Windows, for example, this is implemented using QueryPerformanceFrequency and FileTimeToSystemTime which provides resolution measured in nanoseconds.

    In Node, if you specify setTimeout(callback, 1) then it will be executed one millisecond later (assuming the system doesn’t delay it due to be overwhelmed). In browsers, the minimum time will be 4 milliseconds as specified by the HTML5 spec: https://developer.mozilla.org/en/DOM/window.setTimeout. This isn’t a guaranteed time, just a minimum. Most browsers can be expected to have a ~15ms resolution which impacts DOM animations.

    One valid piece of info is that timeouts set to the same millisecond, during the same frame, will be executed in the order they were queued. If you were to do:

      setTimeout(callback1, 1);
      setTimeout(callback2, 1);
      setTimeout(callback3, 1);
      setTimeout(callback4, 1);
    

    All in one block, Node should call them in that order. This only applies if they have the exact same resolution time.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms724280(v=vs.85).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What web browsers use the __proto__ ? Mozilla states that: Note that __proto__ may
I'd like to use this function to rotate then stop at a particular point
What are some platform-specific API's that web browsers use to securely save passwords with
Does websites created by Flex Builder works on every browsers that use Flash ?
Is there a way to use ASP.NET in browsers that javascript is not enabled?
Mobile browsers. Jquery dialog alert box. I don't want to use alert() because it
i have popup-window in my script. I use window.open, but almost all browsers block
Does this pattern: setTimeout(function(){ // do stuff }, 0); Actually return control to the
I know that currently HTML5 video compatible browsers use the Accept-Ranges header to seek
What engines do these browsers use: Firefox; is it Gecko? Safari; is it Webkit?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.