Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an asynchronous getter (Promise) for screen availability status #11

Closed
markafoltz opened this issue Sep 3, 2014 · 3 comments
Closed

Comments

@markafoltz
Copy link
Contributor

From http://webscreens.github.io/presentation-api/#open-questions:

If there are already connected screens when the page subscribes to the onavailablechange event, we can handle this in two ways: We can synthesize one initial event to notify the page about available screens as soon as the first event handler is installed (as described). Or we can add another message like navigator.presentation.getAvailable(function(available) { } ); to notify the page about available screens using this one-time asynchronous getter. Which way should we go?

Also see: https://github.com/webscreens/presentation-api/issues/8

@avayvod
Copy link
Contributor

avayvod commented Sep 4, 2014

Why can't we just have an "available" property to match the event? This seems to be the consistent thing with other APIs.

@markafoltz
Copy link
Contributor Author

The algorithm in the current specification is defined in terms of an event based approach, and according to the Promises Guide it's appropriate when there may be multiple results from one asynchronous getter.

We may reopen this when the Streams API become more fully defined.

@anssiko
Copy link
Member

anssiko commented Feb 10, 2015

I think the current events based approach [1] is a better fit for conveying the availability information in the Presentation API, since the data involved is not large. The relevant Promises Guide section is Recurring Events [2].

An example of an API that builds upon the Streams API is e.g. TCP and UDP Socket API [3]. This API potentially produces large amounts of data and as such is a good fit for Streams API.

[1] http://w3c.github.io/presentation-api/#the-onavailablechange-eventhandler
[2] http://www.w3.org/2001/tag/doc/promises-guide#recurring-events
[3] http://www.w3.org/2012/sysapps/tcp-udp-sockets/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants