the usage scenarios
Multiple Interface Data on the Same Page
1. Use events object
EventEmitter.emit(eventsName1,postdata1); EventEmitter.once(evnetsName1,callback); EventEmitter.emit(eventsName2,postdata2); EventEmitter.once(evnetsName2,callback);
2. use Promise
Please compare the performance and effect of the two schemes.
Thank you very much
Promise is realized. Bluebird is much faster than V8 native, close to callback；;
Promise can become the so-called Monad of Functional Programming inside, which is most effective in dealing with i/o; Event Emitter is the logic of stateful. So the choice is not mainly based on performance (don’t choose V8 Promise), but on your entire code Pattern.