Older: 2015-10-15a Thursday -- index card #journal.png
Newer: 2015-10-15c Cleaning HTML -- index card #javascript #programming #munging.png
2015-10-15b Getting the hang of Q promises -- index card #javascript #programming #async.png
2015-10-15b Getting the hang of Q promises -- index card #javascript #programming #async.png

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

Older: 2015-10-15a Thursday -- index card #journal.png
Newer: 2015-10-15c Cleaning HTML -- index card #javascript #programming #munging.png

Sketches are (c) 2007-2025 Sacha Chua - Creative Commons Attribution License 4.0 unless otherwise specified. This means you can freely share and adapt the sketches (even commercially) if you include attribution and indicate the license and any changes, like this: (c) 2025 Sacha Chua - Creative Commons attribution license