Extending Backbone.js constructors, the easy way

One thing that really is really annonying with backbone 1.1 is the fact that the options are not passed has this.options anymore in the Backbone.View.

Well simply enough we can add this (or anything else) in the view constructor.

// Compatibility override - Backbone 1.1 got rid of the 'options' binding
// automatically to views in the constructor - we need to keep that.
Backbone.View = (function(View) {
   return View.extend({
        constructor: function(options) {
            this.options = options;
            View.apply(this, arguments);
Read the rest

Releasing Backbone Mobile Components

Doing mobile web apps can be challenging, not that it’s really harder than doing desktop style app, it’s just different. When doing mobile web you need to focus on simplicity & performance.

When I started dabbling into doing mobile web apps with Backbone.js I really wanted to abstract from the start the mobile part to focus on building great apps. That’s why I builded Backbone Mobile Components.

It’s 7 components that helps you doing mobile with backbone easier. It also … Read the rest

Handling multiple collection.add events in a batch

I had this problem in a web app where I would fetch a list of new models for a collection & those model would inevitably trigger the add event that would add them separately on the page.

However as you guys know it’s always better to add 1 element containing all your new views than adding each one separately.

In the end I decided to settle for throttling the add event with a little setTimeout() collecting all the model to … Read the rest

Implementing live updates with Backbone.js

I don’t know about you, but backbone.js always left me crave for more. It’s the simplicity of it that makes me want to learn how others are using it to solve real world problems. When I’ve started work on Clevertim CRM, which heavily uses backbone.js, I wanted to read about some of the real world problems and their solutions, in order to reuse as much as possible, rather than spend time re-inventing the wheel. In the end, I had … Read the rest

Scaffolding backbone generators like a boss

Every developers dreams of having it’s own command line and generators, well GruntJS, makes this easy. I recently created a small plugins that helps you create your own generators for backbone or any projects : grunt-bb-generate.

It follows the DFGIMW mantra (don’t fucking get in my way). It aims at be easily modifiable to fit any architecture being backbone or others.

Usage Examples

The typical command would be:

  grunt bb_generate:router:name

With the detault options that … Read the rest

Realtime web applications with streaming REST

In this session, Brad will show how to build a real-time layer on top of an existing Rails application’s authorization and resource logic so that you can build on top of the hard work already invested in your Rails application.

Read the rest

Using Backbone.js with Rails: Patterns from the Wild

In this talk Sarah demystify Backbone, Sarah show several very different ways she used it on real Rails apps. You’ll get a feel for the circumstances when Backbone makes sense, and moreover, when each of the different approaches to Backbone make sense.

Read the rest

State of the backbone

Read the rest

Backbone View-Model Binding

This article briefly discusses how the Backbone.View class is normally used and then introduces a new class that helps makes it easy to synchronize your models and views.

The Backbone.View class helps you do a couple of important things that I’ll discuss in very brief detail:  (I assume that you are already familiar with Backbone.Views)

  • Create browser DOM elements
  • Listen to DOM element events
  • Listen to model events

Create browser DOM elements:

Backbone.View objects have a default view.el field that … Read the rest

Using backbone.js in my first product, what I learned

This week I launched an online wedding planner called WeddingDeck. Weddingdeck has backbone in it’s heart. There has been ups and downs while using it, and I wanted today to talk about a couple of stuff that happened to me along the road.

Defining your structure

There is no predefined structure shipped with backbone. Much like jQuery in fact, you kind of have to make your own. Personally I would prefer if there was a preferred structure explained (just … Read the rest