Merge pull request #1394 from grindhold/master

EmberScript support
This commit is contained in:
Arfon Smith
2014-08-18 13:55:44 -05:00
2 changed files with 31 additions and 0 deletions

View File

@@ -653,6 +653,14 @@ Emacs Lisp:
- .el
- .emacs
EmberScript:
type: programming
color: "#f64e3e"
lexer: CoffeeScript
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