W3C home > Mailing lists > Public > public-secondscreen@w3.org > April 2015

Re: Rethinking availability monitoring

From: Kostiainen, Anssi <anssi.kostiainen@intel.com>
Date: Mon, 27 Apr 2015 15:31:10 +0000
To: Anton Vayvod <avayvod@google.com>
CC: "mark a. foltz" <mfoltz@google.com>, "public-secondscreen@w3.org" <public-secondscreen@w3.org>, Mounir Lamouri <mlamouri@google.com>
Message-ID: <4948AB97-47DC-4CDF-B1CF-5394B4B99769@intel.com>
Hi Anton,

> On 25 Apr 2015, at 22:03, Anton Vayvod <avayvod@google.com> wrote:
> Having discussed this with Mounir recently, the right approach would be to return an object via Promise that has a bool and an event handler. This way the UA doesn't have to do weird tricks like detect if anything is subscribed to the event to start/stop discovery, there's no compromise between the attribute being initialized or firing the event immediately after a listener is attached and even gives more flexibility if the page wants to filter the events - pass the parameters to the Promise returning method.
> partial interface NavigatorPresentation {
>   Promise<AvailabilityListener> listenForAvailability(/*DOMString presentationUrl, params*/);
> }
> interface AvailabilityListener : EventTarget {
>   readonly attribute boolean available;
>   attribute EventHandler onavailablechange;
> }
> One may need some way to discard the listener to signal the UA that the page is not interested in the screens anymore.

Thanks, this looks good to me, perhaps with some bikeshedding about naming :-)

We've used a similar design in other specs, for example:

* Battery Status API (http://www.w3.org/TR/battery-status/)
* Permissions API (https://w3c.github.io/permissions/)

... so this has proven to work and is implementable.


-Anssi (WG chair)
Received on Monday, 27 April 2015 15:31:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:18:52 UTC