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

Projects
None yet
2 participants
@trabianmatt
Contributor

trabianmatt commented Jan 17, 2013

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!

Support existing 'events' attribute as function
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

This comment has been minimized.

Show comment
Hide comment
@delambo

delambo Jan 18, 2013

Member

Good stuff. Thanks, Matt!

Member

delambo commented Jan 18, 2013

Good stuff. Thanks, Matt!

trabianmatt added 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