akuchling: Sherlock Hemlock (Default)
[personal profile] akuchling
There are many JS frameworks out there, and I want to learn one. I chose Backbone.js. (Angular is probably more popular, but also facing a Python 3-ish transition, so I let it slide.)

Backbone.js: one of a bunch of MVC-ish frameworks. Others include Angular, Spine, JavaScript MVC, Ember, Knockout.

TodoMVC is a to-do list app built in several different frameworks so you can compare them.

Backbone provides:

Models: represent domain objects.

  Wine = Backbone.Model.extend();   // Creates a model
  w = new Wine({prop1: val1, prop2: val2, ...})
  w.toJSON()
Collections: a bunch of Model objects. Will apparently infer a REST-ish backend automatically.
 WineList = Backbone.Collection.extend({
   Model: Wine,
   url: "http:..."     // URL for the REST back-end
  })
  wines = new WineList([list of objects used to create Wine instances]);
  wines.each(function (w) {...})
Views:
  HomeView = Backbone.View.extend();
  view = new HomeView();
  view.render()

Templates: Backbone uses Underscore for templating by default.

Routes: recording app state in the URL, and moving between different states.

  wineApp = new AppRouter();
  wineApp.routes = dict of string to method name

Events:

View.events = dict of event name to method name called when event is triggered.

From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

Profile

akuchling: Sherlock Hemlock (Default)
akuchling

September 2016

S M T W T F S
    123
45678910
11121314151617
18192021222324
2526272829 30 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 23rd, 2017 03:39 am
Powered by Dreamwidth Studios