Skip to content

Instantly share code, notes, and snippets.

@unr
Created April 15, 2013 16:00
Show Gist options
  • Save unr/5389172 to your computer and use it in GitHub Desktop.
Save unr/5389172 to your computer and use it in GitHub Desktop.
Example of my Project model.
App.Project = Em.Object.extend
# Trying to optimize phase load times
showPhases: false
phases: (->
if !@_children
@set '_children', Em.A()
childPhases = @get('childPhases')
if childPhases
childPhases.forEach( (phase) =>
Ember.run.once(this, ->
phase.active = (phase.active is '1') ? true : false
@_children.addObject App.Phase.create(phase)
)
)
Ember.run.next(this, ->
@set('showPhases', true)
)
return @_children
).property('_children', 'childPhases', 'showPhases')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment