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

Idea: automatically bind observers and event handlers #1001

Closed
rstacruz opened this issue Jul 17, 2014 · 2 comments
Closed

Idea: automatically bind observers and event handlers #1001

rstacruz opened this issue Jul 17, 2014 · 2 comments

Comments

@rstacruz
Copy link
Contributor

I've been working on an Ractive app, and this pattern of automatically adding event hadlers and observers is very pervasive:

module.exports = Ractive.extend({
  init: function () {
    this.on(this.eventHandlers);
    this.observe(this.observers);
  },

  eventHandlers: {
    'submit': function () { ... }
  },

  observers: {
    'quantity': function () { ... }
  }
});

...it'd be nice to be able to bind these automatically.

@Rich-Harris
Copy link
Member

Totally get where you're coming from - this was actually discussed this in a previous issue. But it turns out to be a bit more complicated than it first looks - I dug into it a bit a while back and realised that it creates a lot of problems. I jotted down some of my thoughts here.

@rstacruz
Copy link
Contributor Author

Awesome. Closing this now as a dupe of #360 and #405. Thanks for your consideration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants