Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Backbone.js offline

I'm evaluating Backbone.js for keeping data and UI synchronized in my web app. However, much of Backbone's value seems to lie in its use of RESTful interfaces. Though I may add server-side backup in the future, my primary use case involves storing all data offline using HTML5 local storage.

Is Backbone overkill for such a use case? If so, is there a better solution, focused solely on updating UI when data changes, and vice versa? (I'm also looking into Knockout and Javascript MVC.)

EDIT: I'm also now looking into Angular.js and jQuery Data Link.

like image 363
Luke Dennis Avatar asked Jan 28 '11 22:01

Luke Dennis


People also ask

Do people still use Backbone JS?

Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.

How does Backbone JS work?

Backbone. js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.

Is Backbone JS frontend or backend?

Front-End MVC frameworks (Backbone, Angular, etc) all rely on a backend service to provide the data that, say Backbone, would then use as its model. You could have an entire MVC pattern on the backend that accepts requests and spits out some JSON for a frontend MVC framework to use.

Who uses backbone JS?

Who uses Backbone. js? 3466 companies reportedly use Backbone. js in their tech stacks, including Uber, Pinterest, and reddit.


1 Answers

Backbone.js works just as well with local storage as it does with RESTful queries.

I'm a learn-by-example kind of guy so here are some links to get you started:

  • Todos, a todo application that uses local storage and backbone.js, check out the annotated source to see how it works.

  • The localStorage adapter is all you need to get started, take a look at the annotated source of that too.

like image 99
DaveJ Avatar answered Oct 05 '22 16:10

DaveJ