Skip to content

Instantly share code, notes, and snippets.

@AmilKey
Created December 9, 2015 08:04
Show Gist options
  • Select an option

  • Save AmilKey/a738e4f6622dab93dfdc to your computer and use it in GitHub Desktop.

Select an option

Save AmilKey/a738e4f6622dab93dfdc to your computer and use it in GitHub Desktop.
computed property with Promise
delegate methods to proxy object
proxyToContent = (method) ->
->
content = Ember.get(@, 'content');
content[method].apply(content, arguments)
appointment: Ember.computed 'pet.id', ->
appointment = Promise()
newAppointment = DS.PromiseObject.create
promise: appointment
save: proxyToContent('save')
validate: proxyToContent('validate')
newAppointment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment