rstacruz/backbone-patterns — Issue #1: Issue with the animation pattern implementation.
Author: francois2metz
Created: 2011-11-29 19:44:21+00:00
State: open

There is a bug with your Animation pattern implementation.

```javascript
Buffer = {
commands: [],

// Adds a command to the buffer, and executes it if it's the only command
// to be ran.
add: function(fn) {
this.commands.push(fn);
if (this.commands.length == 1) fn();
},

// Moves onto the next command in the buffer.
next: function() {
this.commands.shift();
if (this.commands.length) this.commands.shift()();
}
};
```

The add function should not call the callback *fn* but call next instead.

```javascript
Buffer = {
commands: [],

// Adds a command to the buffer, and executes it if it's the only command
// to be ran.
add: function(fn) {
this.commands.push(fn);
if (this.commands.length == 1) this.next();
},

// Moves onto the next command in the buffer.
next: function() {
if (this.commands.length) this.commands.shift()();
}
};
```
Cannot provide a pull request because your master branch is not up to date.

Bye,
François