- From: Jake Archibald <notifications@github.com>
- Date: Mon, 15 Dec 2014 11:10:45 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/588/67047341@github.com>
If `getAll` returns different types, given that workers are still pretty rare, I'm worried that code would appear to work, go live, then start failing because a worker was present.
```
interface BasicClient {
readonly attribute USVString url;
readonly attribute ServiceWorkerRegistration? serviceWorkerRegistration;
void postMessage(any message, optional sequence<Transferable> transfer);
}
interface WindowClient : BasicClient {
readonly attribute VisibilityState visibilityState;
readonly attribute boolean focused;
readonly attribute ContextFrameType frameType;
Promise<focus> focus();
}
```
Assuming you mean the above, it isn't too bad right now. If your code encounters a `BasicClient` for the first time, `.visibilityState != "visible"`, `.focused != true`, `frameType != "top-level". If you call `.focus()` you're going to throw an error, that won't often be different from rejecting, but I don't know how much money I'd bet on that.
Adding stuff to `WindowClient` in future may be tough.
Assuming we went with the above, what API would you prefer for opening a window, considering a constructor here is undesirable? `clients.openWindow(url)`, `WindowClient.open(url)`?
---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/588#issuecomment-67047341
Received on Monday, 15 December 2014 19:11:16 UTC