Here is the source - Todo Javascript Source
addOne expects one argument
this.listenTo(Todos, 'add', this.addOne);
as you can see here:
addOne: function(todo) {
var view = new TodoView({model: todo});
this.$("#todo-list").append(view.render().el);
},
where does it get this, the callback appears to call the function with no arguments?
This line
this.listenTo(Todos, 'add', this.addOne);
tells you precisely nothing about how many arguments will be provided to the callback.
In fact, Backbone event
callbacks receive varying numbers of params which are all cataloged here: http://backbonejs.org/#Events-catalog
In the specific case of add
, the callback params are model
, collection
, and options
.