Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support an existing 'events' function attribute #51

Merged
merged 1 commit into from
Jan 18, 2013

Conversation

trabianmatt
Copy link
Contributor

I occasionally define 'events' as a method on a view (instead of a hash):

class SampleView extends Backbone.View

  events: ->
    click: -> alert 'Clicked!'

Backbone supports this but when I tried to use stickit to bind to a form field the field events were never added to 'events' because 'events' was a function and not a hash. This pull requests adds support for an 'events' function. I added tests for this new case as well as the 'events as hash' case.

Thank you for stickit - I'm looking forward to using it more and contributing where I can!

Stickit binds to form and contentEditable element changes by adding
bindings to a view's 'events' attribute, which may already exist on the view.

This commit updates stickit() to support an existing 'events' attribute
that is specified as a function, which is already allowed by Backbone.
@delambo delambo merged commit f1d1cb1 into nytimes:master Jan 18, 2013
@delambo
Copy link
Member

delambo commented Jan 18, 2013

Good stuff. Thanks, Matt!

trabianmatt pushed a commit to trabianmatt/backbone.stickit that referenced this pull request Jan 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants