home
  • Blog
  • Home
  • Projects
    • Ember
    • EmberData
    • Ember CLI
6.2
  • Packages
    • @ember/application
    • @ember/application/namespace
    • @ember/array
    • @ember/array/proxy
    • @ember/canary-features
    • @ember/component
    • @ember/component/template-only
    • @ember/controller
    • @ember/debug
    • @ember/debug/container-debug-adapter
    • @ember/debug/data-adapter
    • @ember/destroyable
    • @ember/engine
    • @ember/helper
    • @ember/object
    • @ember/object/core
    • @ember/object/evented
    • @ember/object/mixin
    • @ember/object/observable
    • @ember/object/promise-proxy-mixin
    • @ember/object/proxy
    • @ember/owner
    • @ember/renderer
    • @ember/routing
    • @ember/routing/hash-location
    • @ember/routing/history-location
    • @ember/routing/location
    • @ember/routing/none-location
    • @ember/routing/route
    • @ember/routing/route-info
    • @ember/routing/router
    • @ember/routing/router-service
    • @ember/routing/transition
    • @ember/runloop
    • @ember/service
    • @ember/template
    • @ember/test
    • @ember/utils
    • @glimmer/tracking
    • @glimmer/tracking/primitives/cache
    • rsvp
  • Classes
    • Application
    • ApplicationInstance
    • ApplicationInstance.BootOptions
    • ArrayProxy
    • Component
    • ComputedProperty
    • ContainerDebugAdapter
    • CoreObject
    • DataAdapter
    • Ember.Controller
    • Ember.NativeArray
    • Ember.Templates.helpers
    • Ember.Test
    • Ember.Test.QUnitAdapter
    • EmberArray
    • EmberENV
    • EmberObject
    • EmberRouter
    • Engine
    • EngineInstance
    • EventTarget
    • Evented
    • Factory
    • FactoryManager
    • FullName
    • HashLocation
    • Helper
    • HistoryLocation
    • Location
    • Mixin
    • MutableArray
    • Namespace
    • NoneLocation
    • ObjectProxy
    • Observable
    • Owner
    • Promise
    • PromiseProxyMixin
    • RegisterOptions
    • Renderer
    • Resolver
    • Route
    • RouteInfo
    • RouteInfoWithAttributes
    • RouterService
    • SafeString
    • Service
    • TestAdapter
    • Transition

Class PromiseProxyMixin public


Defined in: packages/@ember/object/promise-proxy-mixin.ts:46
Module: @ember/object/promise-proxy-mixin
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';

A low level mixin making ObjectProxy promise-aware.

import { resolve } from 'rsvp';
import $ from 'jquery';
import ObjectProxy from '@ember/object/proxy';
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';

let ObjectPromiseProxy = ObjectProxy.extend(PromiseProxyMixin);

let proxy = ObjectPromiseProxy.create({
  promise: resolve($.getJSON('/some/remote/data.json'))
});

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

the proxy has bindable attributes which track the promises life cycle

proxy.get('isPending')   //=> true
proxy.get('isSettled')  //=> false
proxy.get('isRejected')  //=> false
proxy.get('isFulfilled') //=> false

When the $.getJSON completes, and the promise is fulfilled with json, the life cycle attributes will update accordingly. Note that $.getJSON doesn't return an ECMA specified promise, it is useful to wrap this with an RSVP.resolve so that it behaves as a spec compliant promise.

proxy.get('isPending')   //=> false
proxy.get('isSettled')   //=> true
proxy.get('isRejected')  //=> false
proxy.get('isFulfilled') //=> true

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

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

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


Methods

catch (callback) : RSVP.Promise public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts: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/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:199

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/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:176

callback
Function
returns
RSVP.Promise

An alias to the proxied promise's then.

See RSVP.Promise.then.

Properties

isFulfilled public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:145

Will become true if the proxied promise is fulfilled.

isPending public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:120

Once the proxied promise has settled this will become false.

isRejected public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:137

Will become true if the proxied promise is rejected.

isSettled public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:128

Once the proxied promise has settled this will become true.

promise public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:154

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:

import ObjectProxy from '@ember/object/proxy';
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';

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

reason public

Module: @ember/object/promise-proxy-mixin

Defined in packages/@ember/object/promise-proxy-mixin.ts:110

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.