From what I have understood there are three ways of calling asynchronous code:
- Events, e.g.
request.on("event", callback);
- Callbacks, e.g.
fs.open(path, flags, mode, callback);
- Promises
I found the node-promise library but I don’t get it.
Could someone explain what promises are all about and why I should use it?
Also, why was it removed from Node.js?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…