ember-computed-promise-monitor
This provides the ability to manage async behavior with computed properties as a light-weight alternative to, or in conjunction with ember-concurrency.
Compatibility
- Ember.js v2.18 or above
- Ember CLI v2.13 or above
Installation
ember install ember-computed-promise-monitor
Usage
;;;
{{#if postName.isPending}} Loading...{{else}} {{postName.result}}{{/if}}
or with a decorator:
; // ... get postName
How is this different from PromiseProxy?
You can get similar functionality by using PromiseProxyMixin:
;;; let ObjectPromiseProxy = ObjectProxy; let proxy = ObjectPromiseProxy;
{{#if postName.isPending}} Loading...{{else}} {{postName.result}}{{/if}}
The key differences are that the PromiseProxyMixin
:
- proxies all properties to the resolved value
- uses
content
for the resulting value, which may be confusing (and is undocumented) - throws an exception on promise rejection.
PromiseMonitor
sets the error on theerror
property.
License
This project is licensed under the MIT License.