Skip to content

Instantly share code, notes, and snippets.

@rounders
Created July 16, 2015 23:25
Show Gist options
  • Save rounders/7591bcc7c7aac95f0e8f to your computer and use it in GitHub Desktop.
Save rounders/7591bcc7c7aac95f0e8f to your computer and use it in GitHub Desktop.
ember component
`import Ember from 'ember'`
SavedIndicatorComponent = Ember.Component.extend
_saveCount: 0
attrs:
saveCount: 0
duration: 2000
attributeBindings: ['style']
style: 'display: none;'.htmlSafe()
didUpdateAttrs: ->
if @getAttr('saveCount') != @get('_saveCount')
@set('_saveCount', @getAttr('saveCount'))
@show()
show: ->
Ember.run.scheduleOnce 'afterRender', @, ->
@$().fadeIn()
Ember.run.later @, (->
@$().fadeOut()
), @getAttr('duration')
`export default SavedIndicatorComponent`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment