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 1072883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:55:12+00:00 2026-05-16T20:55:12+00:00

Is there a jQuery equivalent to prototype’s defer? I’m looking for something that will

  • 0

Is there a jQuery equivalent to prototype’s defer?

I’m looking for something that will delay the execution of a script until all of the scripts in the page are finished executing.

Thanks!


PART II:
Is there any way to see if there are other setTimeouts in the queue and delay execution until after they fire? I see in the comments that sometimes setTimeout of 0 or 1 doesn’t matter because it’s unpredictable as to which will fire first.

Thanks again!

Update to answer

I found a bug in the code that I was using from the answer accepted below. The slice call needs to work on 0, not 1 since in the Prototype core code, it’s accepting an extra parameter for the amount of time to wait (0.01). The final method then becomes:

Function.prototype.deferFunc = function() {
   var __method = this, args = Array.prototype.slice.call(arguments, 0);
   return window.setTimeout(function() {
      return __method.apply(__method, args);
   }, 0.01);
}
  • 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-16T20:55:13+00:00Added an answer on May 16, 2026 at 8:55 pm

    All defer does is execute the function inside window.setTimeout with timeout of 0.

    You can implement it like this I am sure:

    Function.prototype.defer = function() {
            var __method = this, args = Array.prototype.slice.call(arguments, 1);
            return window.setTimeout(function() {
              return __method.apply(__method, args);
            }, 0);
          }
    

    Demo

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

Sidebar

Related Questions

I am looking for an equivalent to jquery's load() method that will work offline.
Is there a jQuery plugin or effect that will create an overlay/lightbox effect around
Is there some equivalent to jQuery's getScript in Prototype ?
Does the Prototype Javascript library have a selector that's equivalent to jQuery's :contains() ?
Is there a jQuery equivalent to this prototype code? Ajax.Responders.register({ onException: function(x,y) { if(y.message!=Syntax
Is there any equivalent in Prototype for the jQuery closest function? http://api.jquery.com/closest/ thanks
Is there an equivalent to the Rails/Prototype observe_field method using jQuery without jRails? I
Anyone know if there is an equivalent method in jquery or javascript that matches
Is there a native javascript code equivalent to jQuery's draggable? I don't need all
Is there any JQuery method/implementation that equivalent to YUI.getElementsBy? YUI.getElementsBy ( method , tag

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.