Getting the hang of Q promises
var q= require('q'); function doSomething () { var deferred = 9. defer(); Long Running (function (val) { deferred. resolve (val); 3 }); or reject return deferred. promise; 2015-10-15b also handy: 9. all, q. all Settled: be sure to have array of valves or promise: . → alternatively, return longrunning (). then (....) Gif already a promise important! Can return value or doSomething. then (...) catch (...) · finally (...); •promise (9(-). then (-) will do the right thing