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… 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… 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.

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.

State of the backbone

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… 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… Read the rest

jQuery Mobile and backbone.js, the ugly

jQuery Mobile is a great technology, no doubt it can be an integral part of the future like jQuery is today. However even if the 1.0 version is out after more than a year after the alpha has been launched, it still feels like a very young product. There is enough posts and beginner tutorials around the web about the greatness of jQuery mobile. But not so much about the hurdles of jQuery mobile integrated in other systems. Let’s dive… Read the rest

Optimizing the views list creation with document fragment

Before using backbone when working with a list of html nodes I always made it my duty to append them only in one big chunk of text. Manipulating the dom is slow, it triggers a reflow of the page, this is costly even on small lists, specially on mobile.

So being not sure what to do with backbone I decided to append each view directly in my container like this.

  var jqGuestList 

Read the rest

There is no magic behind backbone.js model.isNew()

model.isNew() can be quite useful, this method can be interesting when handling and changing forms behaviors from adding new items, to updating and deleting them. At first I did not quite understand how isNew() was working internally and, one day it just stopped working and that was frustrating!

It’s all about the id

One thing I like to do is prepopulate my fields with defaults values. Backbone has a great feature for that, when instantiating a model you can pass… Read the rest