It was quite some time ago. I was sitting in the open courtyard of the German bakery Café in Kathmandu Napal. I was sitting there reading my book and taking notes preparing for my truckIn the Himalayas. I was in town to arrange for my journey. As I sat there I suddenly heard a sound,As a grapefruit dropped from the tree above, Bounced on the floor beside me, and landed perfectly on the plate in front of me.
I looked around, and I realized that no one else has seen the grapefruit fall from the sky and land on my plate.So, I ate a grapefruit.
Backbone has landed on your plate, and I’m here to encourage you to go ahead and dive in.
What Is Backbone? * A set of helper primitives: Models, Views, Collections, plus: Router, Events, History Data - Bootstrapping, AJAX/AJAJ, JSON REST API - https://wordpress.org/plugins/json-rest-api/
Why use Backbone? Highly interactive pages - front end or admin Single page application with more than one state Helps keep your code organized and maintainable Some Examples http://backbonejs.org/#examples Backbone in core - media, revisions, themes, customizer Where could we use it in core? List table, plugin installer, menus, settings, everywhere! Adding to a theme or plugin - just enqueue ‘backbone’!
Models - things that hold data, maybe controller logic Collections - groups of models Views - rendering models or collections, responding to events
BACKBONE.EVENTS A module that can be mixed in to any object in order to provide it with custom events.
BACKBONE.MODEL Backbone Models are the basic data object in the framework.
BACKBONE.COLLECTION A Backbone Collection is analogous to a table full of models
BACKBONE.SYNC Override this function to change the manner in which Backbone persists models to the server.
BACKBONE.ROUTER Routers map faux-URLs to actions, and fire events when routes are matched.
BACKBONE.HISTORY Handles cross-browser history management
Put a little Backbone in your WordPress
Put a little
☛ Backbone is Awesome
☛ Includes Underscore.js, also awesome
☛ WordPress makes Backbone easier
Backbone is Awesome
Philosophically, Backbone is an
attempt to discover the minimal set
of data-structuring (models and
collections) and user interface (views
and URLs) primitives that are
generally useful when building web
☛ Prototypes: Models, Collections, Views
☛ Plus: Events, Routes, History
☛ Getting and Saving Data:
☛ JSON REST API
☛ Highly interactive pages - front end or admin
☛ Single page application with more than one state
☛ Helps keep your code maintainable
☛ Gets your truth out of the DOM
☛ Really simple, well documented, easy to understand
☛ Modular - use what you need
☛ Bundled with WordPress
Why use Backbone?
☛ Rdio, Hulu, Gawker, Foursquare, Disqus, Khan Academy,
☛ Backbone in WordPress core…
Backbone in WordPress
☛ what next?
Building a Demo App
☛ Backbone driven plugin to
display user directory
☛ Grabs data by scraping
☛ Data stored in CPT,
passed via JSON REST
• Save assembly code onto cassettes
• Love contributing to WordPress Core
• Revisions Component Maintainer
• Managing Engineer at 10up