home
  • Blog
  • Home
  • Projects
    • Ember
    • EmberData
    • Ember CLI
1.13
  • Packages
    • ember
    • ember-application
    • ember-debug
    • ember-extension-support
    • ember-htmlbars
    • ember-metal
    • ember-routing
    • ember-routing-htmlbars
    • ember-routing-views
    • ember-runtime
    • ember-templates
    • ember-testing
    • ember-views
  • Namespaces
    • Ember
    • Ember.FEATURES
    • Ember.String
    • Ember.computed
    • Ember.inject
    • Ember.run
  • Classes
    • Ember.Application
    • Ember.Array
    • Ember.ArrayProxy
    • Ember.Binding
    • Ember.Checkbox
    • Ember.Component
    • Ember.ComputedProperty
    • Ember.ContainerDebugAdapter
    • Ember.Controller
    • Ember.ControllerMixin
    • Ember.CoreObject
    • Ember.DataAdapter
    • Ember.DefaultResolver
    • Ember.Error
    • Ember.Evented
    • Ember.Helper
    • Ember.InstrumentationSupport
    • Ember.Logger
    • Ember.Mixin
    • Ember.MutableArray
    • Ember.MutableEnumerable
    • Ember.Namespace
    • Ember.NativeArray
    • Ember.Object
    • Ember.Observable
    • Ember.PromiseProxyMixin
    • Ember.Route
    • Ember.Router
    • Ember.Service
    • Ember.Test
    • Ember.Test.Adapter
    • Ember.Test.QUnitAdapter
    • Ember.TextArea
    • Ember.TextField
    • Ember.VisibilitySupport
    • RSVP.EventTarget
    • RSVP.Promise

Class Ember.PromiseProxyMixin public


Defined in: packages/ember-runtime/lib/mixins/promise_proxy.js:36
Module: ember

A low level mixin making ObjectProxy, ObjectController or ArrayControllers promise-aware.

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

var controller = ObjectPromiseController.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

controller.get('isPending')   //=> true
controller.get('isSettled')  //=> 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.

controller.get('isPending')   //=> false
controller.get('isSettled')   //=> 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.

// 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

{{#if isPending}}
  loading...
{{else}}
  firstName: {{firstName}}
  lastName: {{lastName}}
{{/if}}


Methods

catch (callback) : RSVP.Promise public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:187

Available since v1.3.0

callback
Function
returns
RSVP.Promise

An alias to the proxied promise's catch.

See RSVP.Promise.catch.

finally (callback) : RSVP.Promise public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:200

Available since v1.3.0

callback
Function
returns
RSVP.Promise

An alias to the proxied promise's finally.

See RSVP.Promise.finally.

then (callback) : RSVP.Promise public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:175

callback
Function
returns
RSVP.Promise

An alias to the proxied promise's then.

See RSVP.Promise.then.

Properties

isFulfilled public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:140

Will become true if the proxied promise is fulfilled.

isPending public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:113

Once the proxied promise has settled this will become false.

isRejected public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:131

Will become true if the proxied promise is rejected.

isSettled public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:122

Once the proxied promise has settled this will become true.

promise public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:149

The promise whose fulfillment value is being proxied by this object.

This property must be specified upon creation, and should not be changed once created.

Example:

Ember.ObjectController.extend(Ember.PromiseProxyMixin).create({
  promise: <thenable>
});

reason public

Module: ember

Defined in packages/ember-runtime/lib/mixins/promise_proxy.js:103

If the proxied promise is rejected this will contain the reason provided.

On this page


Methods

  • catch
  • finally
  • then

Properties

  • isFulfilled
  • isPending
  • isRejected
  • isSettled
  • promise
  • reason
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2025 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue Created with Sketch.