W3C home > Mailing lists > Public > public-secondscreen@w3.org > December 2016

Re: [presentation-api] Step 11 of getAvailability should not run "in parallel"

From: François Daoust via GitHub <sysbot+gh@w3.org>
Date: Thu, 01 Dec 2016 20:17:24 +0000
To: public-secondscreen@w3.org
Message-ID: <issue_comment.created-264282425-1480623443-sysbot+gh@w3.org>
> If monitoring has not run before for the URLs in the request, we 
should wait until it completes to return a value.

"In parallel" gives the exact opposite result: it makes the monitoring
 run in the background and thus the promise gets resolved immediately 
(before monitoring is complete). Actually, we would not even need a 
Promise given that all other steps can run synchronously.

> If monitoring has run before then we can resolve immediately with a 
known value, and run it again to refresh the value.

A second call to `getAvailability` will always return the presentation
 availability promise set during the first call immediately (step 2). 
This aborts the rest of the algorithm. Which means step 11. will not 
run and the user agent is not required to run the monitoring algorithm
 again (it may still do so given that the spec says it may monitor on 
a continuous basis but that's not mandated in response to the second 
call to `getAvailability`).

> Practically speaking, I expect that developers will need to add an 
onchange handler to get correct availability information, so the page 
will always get the correct value eventually. I guess it's a question 
of whether they care that the initial value may be based on incomplete

I note that could affect tests as well, and @tomoyukilabs raised the 
question of the "initial value" in:

I would personally expect that initial value to convey "complete" 
information, meaning the "same" result as if I had called `start` 
instead of `getAvailability`. In other words, in simple scenarios, I 
would expect developers to be able to rely on the resolution of the 
Promise without having to listen to the `change` event. What would the
 Promise convey otherwise?

This is what the test on `PresentationAvailability` assumes for now.

GitHub Notification of comment by tidoust
Please view or discuss this issue at 
 using your GitHub account
Received on Thursday, 1 December 2016 20:17:33 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 1 December 2016 20:17:33 UTC