emberjs/ember.js — pull request #3084 by stefanpenner (2013-08-02 03:54:19+00:00)
Title: Add Ember.PromiseProxyMixin

A low level mixin making ObjectProxy, ObjectController or ArrayController's promise aware.

```javascript
var ObjectPromiseController = Ember.ObjectController.extend(Ember.PromiseProxyMixin);

var controller = ObjectController.create({
promise: $.getJSON('/some/remote/data.json')
});

controller.then(function(json){
// the json
}, function(reason) {
// the reason why you have no json
});
```

the controller has bindable attributes which
track the promises life cycle

```javascript
controller.get('isLoading') //=> true
controller.get('isResolved') //=> false
controller.get('isRejected') //=> false
controller.get('isFulfilled') //=> false
```

When the the $.getJSON completes, and the promise is fulfilled
with json, the life cycle attributes will update accordingly.

```javascript
controller.get('isLoading') //=> false
controller.get('isResolved') //=> true
controller.get('isRejected') //=> false
controller.get('isFulfilled') //=> true
```

As the controller is an ObjectController, and the json now its content,
all the json properties will be available directly from the controller.

```javascript
// Assuming the following json:
{
firstName: 'Stefan',
lastName: 'Penner'
}

// both properties will accessible on the controller
controller.get('firstName') //=> 'Stefan'
controller.get('lastName') //=> 'Penner'
```

If the controller is backing a template, the attributes are
bindable from within that template
```handlebars
{{#if isLoading}}
loading...
{{else}}
firstName: {{firstName}}
lastName: {{lastName}}
{{/if}}
```