Nodejs Async Series Small White to

Source: Internet
Author: User

Async.series ({
Flag1:function (done) {//FLAG1 is a process ID, user-defined
Logical processing
Done (NULL, "return result")//The first parameter is an exception error, the second parameter returns the result
}
},function (Error,result) {
Final results
Result is a total of returned results, containing all the process controls,
RESULT.FLAG1 can obtain the results of processing in Identity 1
Console.log (Error);
Console.log (result);
if (result.flag1== ' return result ')
{
Console.log (' End ');
}
});

------------------------------------------------

As a small white to see this piece of code is a face of the currency, and now understand to do an analysis.

1.series after the flag1:function format expression is this is a JSON element whose name is Flag1 specific content is the colon after the

What does the content behind 2.FLAG1 mean to be taken out alone?

function (done) {//FLAG1 is a process ID, user-defined
Logical processing
Done (NULL, "return result")//The first parameter is an exception error, the second parameter returns the result
}

Later, it is understood that the arguments passed in after function can be a function, so what it means to do (null, "return result") is to call the function and pass in 2 parameters to simulate the next process.

The function is named one and two respectively.

So it becomes a call to the function to pass in the parameter one and the other is actually a function.

(one);

function One (b,a)
{
Console.log (a);
}

function (done) {//FLAG1 is a process ID, user-defined
Logical processing
Done (NULL, "return result")//The first parameter is an exception error, the second parameter returns the result
};

Nodejs Async Series Small White to

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.