Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Created August 27, 2015 20:46
Show Gist options
  • Select an option

  • Save rondale-sc/9a99bf6da63c4ebc5d6a to your computer and use it in GitHub Desktop.

Select an option

Save rondale-sc/9a99bf6da63c4ebc5d6a to your computer and use it in GitHub Desktop.
import Ember from 'ember';
const slice = Array.prototype.slice;
const PromisableObjectProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
export default function(...args) {
const fn = args.pop();
const dependentKeys = args.slice();
return Ember.computed(...dependentKeys, function() {
const promise = fn.apply(this);
return PromisableObjectProxy.create({
promise: Ember.RSVP.resolve(promise)
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment