Skip to content

Backbone.js plugin breaks when using event map syntax for .on(). #306

@jgerigmeyer

Description

@jgerigmeyer

The Backbone.js plugin's BackboneEventsOn fn expects .on() to have been called with arguments name, callback, and context:

https://github.com/getsentry/raven-js/blob/master/plugins/backbone.js#L14-21

However, Backbone.js also supports calling .on() using the event map syntax (http://backbonejs.org/#Events-on), e.g.:

book.on({
  "change:title": titleView.update,
  "change:author": authorPane.update,
  "destroy": bookView.remove
});

This usage currently throws an error:

Uncaught TypeError: Cannot read property '_callback' of undefined

Am I missing something? I'll try to submit a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions