Re: Google/Mozilla Presentation API update

On 21 Aug 2014, at 18:57, Anton Vayvod <avayvod@google.com> wrote:

> > Jonas’ proposal 2) would give the web developer more information and control over sessions before the picker UI is shown to the user:
> >
> > 2) “There’s a second screen available that has a pre-existing resumable session.”
> >
> > p.onavailablechange = function(e) {
> >   if (e.available && e.sessionAvailable) {
> >     // Pre-existing session found for the same origin, get the user’s consent:
> >     session = p.requestSession('http://example.org/', 'foobar', /* onlyReconnect */ true);
> >     // “example.org wants to ..."
> >   } else {
> >     console.log('No resumable sessions found, do something else.');
> >   }
> > };
> >
> > I think 2) allows easier resuming of pre-existing sessions. The names of the flags to be bikeshed :-)
> 
> Each time I see a boolean flag in the parameters list I feel like having two functions instead with distinctive clear names instead. Maybe have two functions like this:
> 
> partial interface NavigatorPresentation {
>   PresentationSession startSession(DOMString url, DOMString sessionId);
>   PresentationSession joinSession(DOMString url, DOMString sessionId);
> }
> 
> Also, what do the function(s) return if the session is not established (e.g. user exits the selection UI by dismissing the popup menu or there's no existing session to join) ? An uninitialized useless session object? Or should we change the return type to a Promise that passes a session to the caller if it succeeds?

I think we can leave the sessionAvailable sugar out for now, given we should be able to address the use case with requestSession() as discussed at [1], right?

We can note in the spec we’re considering such a flag, and are looking for author feedback.

Thanks,

-Anssi

[1] http://lists.w3.org/Archives/Public/public-webscreens/2014Aug/0062.html

Received on Friday, 22 August 2014 12:57:02 UTC