News for hackers. Stuff that matters.
Re:JavaScript Promises: There and back again by fishtastic on Tuesday December 17, 2013 @12:43PM (#6922449)
I recently found that AngularJS has supports for promises. I replaced some of the callback code to use promises and it's a lot more readable.

Callbacks:

    Backend.CallA(param, function() { 
      aDone = true;
      if (aDone && bDone) { doC(); }
    });
    Backend.CallB(param, function() { 
      bDone = true;
      if (aDone && bDone) { doC(); }
    });
Promises:

    var promiseA = Backend.CallA(param);
    var promiseB = Backend.CallB(param);
    $q.all([promiseA, promiseB]).then(doC);
Re:JavaScript Promises: There and back again by danabramov on Tuesday December 17, 2013 @05:58PM (#6924598)
IIRC Angular's promises are based on stripped down version of Kris Kowal's Q. You may want to check it out:

https://github.com/kriskowal/q

Re:JavaScript Promises: There and back again by jeremya on Wednesday December 18, 2013 @09:41AM (#6927695)
As of AngularJS version 1.2, the promises provider ($q) is fully Promises/A+ compliant.

http://blog.angularjs.org/2013/11/angularjs-120-timely-deliv...