added emberscript and provided sample

This commit is contained in:
grindhold
2014-07-20 08:33:18 +02:00
parent 529d3faaf8
commit 7aca52c68c
2 changed files with 30 additions and 0 deletions

View File

@@ -612,6 +612,13 @@ Emacs Lisp:
- .el
- .emacs
EmberScript:
type: programming
color: "#f64e3e"
extensions:
- .em
- .emberscript
Erlang:
type: programming
color: "#0faf8d"

View File

@@ -0,0 +1,23 @@
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