Tuesday, 14 March 2017

NodeJS - asynchronous functions in sequences

I have two (or more) asynchronous functions - say f1(param,callback) and f2(param,callback) which I want to run in sequence, i.e. I first execute f1 and when completed, I then execute f2 (with the result of f1). This can go on, with f3 being executed after f3. An use case would be that f1 does some processing and f2 can either be the display of the result or further processing. I'm wondering what is the "cleanest" approach to implement that. I was thinking about asyn.seq but is that really a good approach? Any sample code? Many thanks - Christian



via Christian68

No comments:

Post a Comment