JoshDG
JoshDG

Reputation: 3931

Javascript SDK Facebook: Parallel?

Does the facebook javascript thread run as a single thread or are requests sent out in parallel? If I make two api calls one after another, such that the second relies on the result of the first, do I have to put the second in the first's callback?

Not a programmer by trade so I'm not sure if that lingo was right

Upvotes: 0

Views: 75

Answers (1)

pm_
pm_

Reputation: 853

I think what you mean is asynchronous. Yes, Graph API requests with the JS SDK are asynchronous, for example:

FB.api('/me', function(response) {
    //called when request is complete
    console.log(response.name);
});

So this means that if you make two API calls where the second one relies on the first, then you'll have two call the second one in the first's callback.

Upvotes: 1

Related Questions