RESOLVED WONTFIX 29183
refactor event handling code in WI.Object to make it mixin-able
https://bugs.webkit.org/show_bug.cgi?id=29183
Summary refactor event handling code in WI.Object to make it mixin-able
Patrick Mueller
Reported 2009-09-11 08:07:57 PDT
The current event handling logic in WebInspector.Object (Object.js) is quite nice, but could be made more consumable. Rather than require someone who wants to use it to subclass this class, seems like it would be nice to able to "mixin" the functionality, at an event level. For instance, conceptually I might have a class which has some events, and for each event I might be able to do something like: WebInspector.EventMixin.add(myClass, "fooBar") which would add the methods to the class's prototype addFooBarListener(...) removeFooBarListener(...) _dispatchFooBarEvent(...) These messages would lazily create a _fooBarEventListeners property as needed. Or something. This would then be useful to use instead of the current single-listener event handlers like onattach, onpopulate, etc, in TreeOutline, so that you could have more than one listener without jumping through nasty hoops like daisy chaining them (I assume you could daisy chain them in simple cases).
Attachments
Timothy Hatcher
Comment 1 2009-09-11 17:45:17 PDT
I don't see why this is needed. Any class in the WebInspector should just inherit WebInspector.Object and there is no problem. But I have never been "mix-in" person, so I might not understand the utility.
Timothy Hatcher
Comment 2 2009-09-11 17:47:33 PDT
This would be the first use of mix-ins in the Inspector. So I think we really need to understand the benefit and reasoning. And why the current code isn't enough.
Note You need to log in before you can comment on or make changes to this bug.