Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ERDDUG - Backbone.js

ERDDUG - Backbone.js

Demo of Backbone.js at ERDDUG on 17 March 2012

Avatar for kmckelvin

kmckelvin

March 18, 2012
Tweet

Other Decks in Programming

Transcript

  1. JavaScript (for n00bz!) “JavaScript is the one language people feel

    they can use, without having to learn it first.” Sunday 18 March 12
  2. setName = function(name) { this.name = name } obj =

    { setObjName: setName } obj.setObjName(“John”); setName.call(obj, “John”); setName.apply(obj, [“John”]); this? Sunday 18 March 12
  3. Constructors Album = function(name) { this.name = name; this.showName =

    function() { console.log(this.name) }; } abbey_road = new Album(‘Abbey Road’); abbey_road.showName(); # Logs “Abbey Road” Sunday 18 March 12
  4. Prototypes Album.prototype.showName = function() { console.log(this.name); } Album = function(name)

    { this.name = name; } abbey_road.showName(); # Logs “Abbey Road” abbey_road = new Album(‘Abbey Road’); Sunday 18 March 12
  5. Prototypical Inheritance AudioAlbum = function(name) { this.name = name; }

    AudioAlbum.prototype = Album audio = new AudioAlbum(“Deep Purple”); audio.showName(); # Logs “Deep Purple” Sunday 18 March 12
  6. templates <script id="user" type="text/html"> <li> <p class="name">Hello I'm {{ name

    }}</p> <p> <a href="http://twitter.com/ {{ twitter }}">@{{ twitter }} </a> </p> </li> </script> Sunday 18 March 12
  7. ROUTER var Workspace = Backbone.Router.extend({ routes: { "help": "help", //

    #help "search/:query": "search", // #search/kiwis "search/:query/p:page": "search" // #search/kiwis/p7 }, help: function() { ... }, search: function(query, page) { ... } }); Sunday 18 March 12