Friday, October 15, 2010

Simple Todo App using Backbone

Here's a quick example I threw together of a simple Todo app using Backbone.js. It overrides the Backbone.sync function to persist the tasks to localStorage. I tried to keep it simple.

I'd really like any Backbone gurus to have a look and make suggestions (or make their own fork) for better collection/view handling. Or to just rework it to show "best practices."

Some questions I have are:

  • What's the best way to handle views when the associated model has been destroyed?
  • Is there a better way to handle collections? (A collection controller perhaps?)
  • When a collection is refreshed, is it better to blitz the DOM (as this example does) or loop through the models to see if they already have Views and attach/create as needed?

It seems most of my questions are related to Views, huh?

Well, I'll continue to experiment and if I come to any conclusions I'll be sure and post them. But if you are, or know, anyone well versed in Backbone (can't be too many people, at this point) I'd really like some feedback.

You can see it below, or here.

Enjoy!

Technorati Tags: , ,

No comments:

Post a Comment