DS.PromiseArray

DS.PromiseArray Class

Extends: Ember.ArrayProxy

Uses: Ember.PromiseProxyMixin

Defined in: addon/-private/system/promise-proxies.js:6

Module: ember-data

A PromiseArray is an object that acts like both an Ember.Array and a promise. When the promise is resolved the resulting value will be set to the PromiseArray's content property. This makes it easy to create data bindings with the PromiseArray that will be updated when the promise resolves.

For more information see the Ember.PromiseProxyMixin documentation.

Example

let promiseArray = DS.PromiseArray.create({
  promise: $.getJSON('/some/remote/data.json')
});

promiseArray.get('length'); // 0

promiseArray.then(function() {
  promiseArray.get('length'); // 100
});

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/data/classes/DS.PromiseArray.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部