Hi,
My comments refer to the API on the wiki page [1].
"PowerManager probably should implement the EventTarget interface and
remove the add/remove wake lock listener method. "
=> I agree. This is the same issue than the idleAPI
The main problem is that the current EventTarget API does not cover the
needs of the WebAPIs apparently.
EventTarget allows to specify an event using a string, but sometimes,
one wants to provide fine-granularity for the event.
I think a cross-spec solution would be the best solution, because the
current add/removeSomethingListener approach doesn't scale well.
Proposal:
abilty to create an event target on the fly:
new EventTarget(any eventDecsription)
the argument can be used to describe what the event is like. EventTarget
can be made subclassable so that each subclass defines its semantics for
the description argument.
When generating an EventTarget (or one of its subclass) instance,
regular add/removeEventListener can be used.
What do you think?
David
[1]
https://wiki.mozilla.org/WebAPI/PowerManagementAPI