3 ms·
Part of the problem is that everything is in paragraph form. So for instance the http://documentcloud.github.com/backbone/#Model-fetch http://documentcloud.git
by peregrine 15y ago
Part of the problem is that everything is in paragraph form. So for instance the
http://documentcloud.github.com/backbone/#Model-fetch http://documentcloud.github.com/backbone/#Model-fetch
explains in a paragraph that it updates the object and fires a 'change' event. Right below in
http://documentcloud.github.com/backbone/#Model-save http://documentcloud.github.com/backbone/#Model-save
the text explains how the backbone.sync handles the save function. What's sets me back is that the backbone.sync strings "change" and "update" are both quoted and highlighted just like an "event". It is not apparent from the method call if an event is ever fired. Upon careful inspection you notice it also calls set if the values are passed or values are returned differently. The set method triggers a change event.
Eventually these things become second nature and you just know them. The tricky part is finding a good place to start from. Maybe a list of good practices, maybe a good up to date tutorial showing a simple app that uses models, collections, views, routes, and a real backbone.sync.
- jashkenas 15y agoAh, sorry. In that particular example, all of the highlighted strings: "change", "create", "update", are all JavaScript strings. We should fix the Model#save paragraph to make it clearer that the strings are the potential values of the "method" parameter.
- peregrine 15y agoNo problem, you asked for specific examples, and I figured since I'm writing my first large production backbone.js code I should chime in on my experiences. Thanks for all the great work! I use and love BB, CS and _ everyday.