[webkit-dev] Looking forward to get an advice about event listeners for navigator.battery.

Adam Barth abarth at webkit.org
Mon Mar 5 00:44:32 PST 2012


There's likely a better design for your patch.  For example, each
BatterManager could register itself with the BatteryController.  When
one of these events occurs, the BatteryController could fire the event
on all the BatterManager class, regardless of whether they have
listeners added.  That would relieve you of the need to override any
of EventTarget's methods (and reduce the amount of state that
BatteryController could need to keep).

Adam


On Mon, Mar 5, 2012 at 12:35 AM, Kihong Kwon <kihong.kwon at samsung.com> wrote:
> Hi.
> I'm implementing Battery Status API.
> (https://bugs.webkit.org/show_bug.cgi?id=62698)
> (http://www.w3.org/TR/battery-status/)
>
> I have an issue which would need your comments.
>
> Battery Status API needs to be added under the Navigator class, but there is
> not any event handling logic there.
> Therefore, because I have no other choice, I have implemented the necessary
> event handling logic in the BatteryManager.
> I, however, think it may not look good to add the event listener in the
> Batter Status API itself.
>
> IMHO, the Navigator class would need some sort of event listener handling
> logic similar to DOMWindow.
> I would like to have your comments how you think this.
>
> Thank you.
>
> Best Regards.
> Kihong
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


More information about the webkit-dev mailing list