3 ms·
It's just JavaScript, so they should work together fine: Todo = Backbone.Model.extend done: -> @get("status") is "done" toggle:
by jashkenas 16y ago
It's just JavaScript, so they should work together fine:
Todo = Backbone.Model.extend
done: ->
@get("status") is "done"
toggle: ->
@set status: if @done() then "active" else "done"
Doing a quick Backbone.coffee version would be fun though, hmm...
- boothead 16y agoTBH I was a little surprised that you didn't write this in coffee in the first place :-) Isn't this the kind of thing that coffee would be aimed at?
- jashkenas 16y agoYes, and the CoffeeScript version would probably perform marginally faster. But pragmatism comes first. Because this is a part of a grant-funded project, it needs to be available and accessible to the widest possible audience -- and that means JavaScript.