Comment 58 for bug 604635

Revision history for this message
In , Justin-lebar+bug (justin-lebar+bug) wrote :

Looks pretty good!

Some details for when you translate this to IDL:

The |ACString|s should be |DOMString|s.

You also need corresponding removeWakeLock{Acquired,Release}Listener functions.

The {add,remove}WakeLock{Acquired,Released}Listener functions don't take an nsIDOMEventListener. That is (I think) the interface which DOM objects which can receive events implement. A DOM event (like the onload event) isn't the same thing as a callback; you have callbacks here.

You'll need to declare a new interface like this:

[function]
interface nsIDOMLockListener : nsISupports {
  void callback(in DOMString aTopic);
};

and pass that as the param to {add,remove}WakeLock{Acquired,Released}Listener.

We should get someone on the WebAPI team to sign off on this API, but it looks good to me. They may want you to fold addWakeLock{Acquired,Released}Listener() into one addWakeLockListener() function (the callback would take a boolean indicating acquired/released); either way is fine, but I don't like boolean arguments, so I prefer the first way. :)

If Jonas doesn't comment in the bug with feedback, you can create an attachment with this pseudocode API and mark "feedback? :sicking".