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

refactor widget event notification #6

Open
wkeese opened this issue Jan 25, 2013 · 0 comments
Open

refactor widget event notification #6

wkeese opened this issue Jan 25, 2013 · 0 comments

Comments

@wkeese
Copy link
Owner

wkeese commented Jan 25, 2013

Remove all the onFoo() stub methods in widgets, or perhaps put them in doc comments so that the doc parser still picks them up.

Simplify _WidgetBase.on() to just delegate to listening for specified event on this.domNode. Code is already there, so it's just a question of removing _onMap() and the code that calls it.

Make all widgets call _WidgetBase.emit() whenever an event occurs, rather than calling the stub function directly.
For native events, like clicking a button, widgets don't need to do anything, except perhaps stop the event if the widget is disabled.

Finally, similar to how _Widget works with this._toConnect (in constructor() and postCreate(), make way so events specified to widget constructors (ex: new Button({onClick: ...}) get mapped to _WidgetBase.on() calls.

Open issues:

  1. Do we need to make exceptions for functions that should be directly assigned to the this, rather than using on()? Doug is always big on onClick() returning a true/false value that can stop event propagation. Maybe there are other cases too.
  2. Also might be nice for backwards-compatibility to keep the code in _WidgetBase.on() that sets up advice on a stub function if it exists, rather than listening for events on the DOMNode. Since that's still considered the standard way for widgets to emit events.
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

1 participant