question

brandon@uprootstudios.com avatar image
brandon@uprootstudios.com asked

Does calling the Server API in a JS function in CloudScript wait for the function to finish?

Here's an example:

handlers.ExampleFunction = function(args, context) {
    Function1();
    Function2(); //does this wait for Function1 to finish before running?
}

function Function1() {
    server.Something();
}

function Function2() {
    server.SomethingElse();
}

Does it wait for Function1 to finish and return before Function2 is run?

CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

Yes, Function2 will be executed after Function1 has been done. Cloud Script is based on JavaScript V8 engine. By default, these functions will be executed synchronously.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.