简体   繁体   中英

The order of the execution of codes and functions in sails.js and node.js

Please look at the picture below and help me

I want to do something like this:

忙碌的猫

I want first part A to be fully executed Then run section B, Because in the first part(A) must the file uploaded compeletly to make the uploaded file name assign to global_d variable, i need this variable in part B.

The next question is how to access a local variable(in this case global_d) from within nested callback functions(in this case part A)?

Please explain me with examples

I hope I have expressed my question carefully.
thank you

The callback function is called when the upload is complete.

Put the call to Book.update inside it.


If you want to avoid nesting, the use Promises and see Removing Nested Promises

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM