#683

A simple playground for learning backbone.js without having to install or configure anything yourself.

HTML

<script src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone.js"></script>
<script src="https://getfirebug.com/firebug-lite.js"></script>

JavaScript

var Todo = Backbone.Model.extend({
    initialize: function(){
        this.bind('some-event', function(){
            console.log('fired');
        });
    }
});

var t = new Todo();

var c1 = new Backbone.Collection([t]);

t.bind('all', function(ev){
  if (ev == 'destroy') t.trigger('some-event');
});

var c2 = new Backbone.Collection([t]);

t.destroy();

console.log(c1.length);
console.log(c2.length);