EmberScript is an open source programming language created in 2012 by Michael Ficarra and Gordon L. Hempton.
#657on PLDB | 12Years Old | 206Repos |
git clone https://github.com/ghempton/ember-script
Ember-infused CoffeeScript
class App.FromNowView extends Ember.View
tagName: 'time'
template: Ember.Handlebars.compile '{{view.output}}'
output: ~>
return moment(@value).fromNow()
didInsertElement: ->
@tick()
tick: ->
f = ->
@notifyPropertyChange 'output'
@tick()
nextTick = Ember.run.later(this, f, 1000)
@set 'nextTick', nextTick
willDestroyElement: ->
nextTick = @nextTick
Ember.run.cancel nextTick
Ember.Handlebars.helper 'fromNow', App.FromNowView