3 ms·
I tried to move to Backbone.js but I'm not sure I like the style of coding it advocates. I ended up moving to KnockoutJS. I find knockout's data-binding and de
by equark 16y ago
I tried to move to Backbone.js but I'm not sure I like the style of coding it advocates. I ended up moving to KnockoutJS. I find knockout's data-binding and dependency tracking more elegant. For instance:
<div data-bind = "style: color: color">Colored text</div>
class SideBar
color: ko.observable("white")
promptColor: ->
cssColor = prompt("Please enter a CSS color:")
@color(cssColor)
sidebar = new SideBar()
ko.applyBindings(sidebar, document.body)
sidebar.promptColor()
This style works pretty well, even as the app becomes large. With backbone I was less sure where to put things and the syntax tended to be more verbose.
[fixed knockout=backbone]
- boucher 16y agoDo you mean to say Backbone in your last sentence?