Skip to content

A bindEvents plan #39

@joeybaker

Description

@joeybaker

What if we remade bindEvents to have 1) a nicer API, and 2) auto-call stopListening?

Here's my thought: we could copy the backbone events object syntax:

, events: {
  'click .mything': 'onMyThingClick'
}
, bbEvents: {
  'change:key model': 'onModelChangeKey'
}
  • keys would be split on a space, just as the events hash does
  • the first part of the key would be the event to listen to
  • the second part of the key would be the object to listen to. this. would be assumed. If omitted, it will listen on the view itself
  • the value would be the name of the function to call
  • bindEvents would then become the method that parses this object. If over-ridden, (as we do now) things would behave as normal. Else, it just parses the bbEvents object. That makes this backward-compatible.

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