Skip to content

Instantly share code, notes, and snippets.

@sleepynate
Created February 1, 2012 06:03
Show Gist options
  • Select an option

  • Save sleepynate/1715403 to your computer and use it in GitHub Desktop.

Select an option

Save sleepynate/1715403 to your computer and use it in GitHub Desktop.
backbone events wat
it("derps when using a space in an event name", function() {
var callback = jasmine.createSpy('-Custom Event Callback-');
obj.bind('all', callback);
obj.trigger("foo bar");
expect(callback.callCount).toBe(1);
expect(callback.mostRecentCall.args[0]).toBe('foo bar');
});
@davemo
Copy link

davemo commented Feb 1, 2012

In the case of

    person.bind("change:name change:location", callback);

the callback will fire two times and the arguments will contain the model and changed value of each field
ie:
callback(model, name);
callback(model, location);

@sleepynate
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment