Day 75, CSS monster is Barry

I can’t believe my eyes. Barry did a complete redesign of the CSS in 12 hours. CSS monster or rather, master!

Now, some intermediate promises:

var p1 = p1Collection.fetch();
var p2 = p2Collection.fetch();
$.when(p1, p2)
  .done(function(){})
  .fail(function(){
    if (p1.state() === 'rejected') {
      //
    }
    if (p2.state() === 'rejected') {
      //
    }
  });
Advertisements
Standard

Day 65, promises

I have learned how to use promises in the client project and I spent some time teaching our current team members on how to use it today.

Basically, you create a deferred object, and return it(*). The promise or the contract is that, in the future, when the object changes its state from pending to resolved / rejected, the object will call its corresponding methods such as: object.then().

* means that the actual returned object is a sealed version of the object, meaning the receiver can observe, but can’t change its state by calling: object.resolve() or object.reject().

From my teaching experience, I feel like nobody gets the concept the first time, but everyone loves it once he finds out what is going on. I can’t imagine a world without promises…

Standard