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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:07:06+00:00 2026-06-10T14:07:06+00:00

In my code, I want to test if a function is asynchronous, and if

  • 0

In my code, I want to test if a function is asynchronous, and if it is, use it’s callback function. But if not, then I’ll just call the next function manually. So is there a way to test if a function is asynchronous? And if not, then where could I find a list of all asynchronous jQuery functions?

if (isAsynchronous(fn)) {
  args.push(function () { alert('callback!'); });
  this.fn.apply(this, args);
} else {
  this.fn.apply(this, args);
  alert('synchronous');
}

So if that is not possible, having a list would be the next best thing.

var asynchs = {
  animate: true,
  fadeIn: true
  //etc...
};

if (asynchs[fn]) {
  args.push(function () {alert('callback!'); });
  this.fn.apply(this, args);
} else {
  this.fn.apply(this, args);
  alert('synchronous');
}
  • 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-06-10T14:07:08+00:00Added an answer on June 10, 2026 at 2:07 pm

    There is no programmatic way to determine if a function is synchronous or asynchronous. In fact, it’s possible for a function to be either synchronous or asynchronous depending upon what it’s passed. Like $.ajax() can be passed a parameter that determines which it is.

    So, if you want to know what a function is, you have to either read the doc or the code.

    In general, if a function offers a “completion” callback or something like that, then you should suspect that it’s probably asynchronous or has an asynchronous option and look in the documentation to confirm. If a jQuery method does not have a completion callback, then it’s probably not asynchronous.

    Other things like $.each() just use callbacks as part of their implementation (they are not “completion” callbacks) and are not asynchronous.

    You should also suspect that ANY method that does animation or networking or waits some period of time is probably asynchronous. The jquery doc is really well written so it’s usually pretty trivial to take a quick look if you’re unsure.

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

Sidebar

Related Questions

i just join phonegap, i want a built test application. i write some code
There is my code that I want to alert test once when mousemove ,
My Objective is : I want to test a piece of code (or function)
I want to test the following code: private bool TestException(Exception ex) { if ((Marshal.GetHRForException(ex)
I want to test performance of my code on both jvm types -client and
I want to test my part of code that returns the users password question.
I have this code in my controller and want to test this code line
I want jenkins to test the code for review. The jenkins job is started
I want to extensively test some pieces of C code for memory leaks. On
I'm writing small XMPP server using boost::asio and I want to unit-test my code.

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.