Chapter 11. The Spine Library
Spine is a lightweight library for JavaScript application development that uses many of the concepts weâve covered in this book, such as MVC, events, and classes. When I say lightweight, I mean lightweightâthe library comes in at around 500 lines of JavaScript, which is about 2K minified and compressed. Donât get the wrong impression, though; Spine will let you build fully featured JavaScript applications while ensuring your code remains clean and decoupled.
I created Spine while writing this book because I couldnât find a client-side MVC framework that quite suited my needs. The library attempts to enshrine many of the best practices proposed in this book, and indeed the bookâs example application, Holla, is built using Spine.
Unlike widget-based libraries such as Cappuccino and SproutCore, Spine doesnât make any decisions about how you display data to users. The emphasis is on flexibility and simplicity. Spine gives you the bare bones and gets out of your way so you get on with the fun stuffâdeveloping awesome applications.
Spine includes a class library with inheritance support; Spine.Class
; an events module, Spine.Events
; an ORM, Spine.Model
; and a controller class, Spine.Controller
. Anything else youâll need, like
templating support or a DOM library, is up to you, so use what youâre most
familiar with. Having said that, Spine includes specific support for jQuery
and Zepto.js libraries, which complement it excellently.
Spineâs ...
Get JavaScript Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.