- From: Jake Archibald <notifications@github.com>
- Date: Fri, 04 Oct 2019 03:43:46 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 4 October 2019 10:44:08 UTC
Originally raised while discussing whether we should have `client.isFrozen` etc.
There's a lot of state data we could attach to clients, but developers also `postMessage` clients to 'ask' for some app-specific data, like "is the user currently typing a message?".
We could improve both situations by allowing developers to attach clonable data to a client.
Rough design that I haven't put much thought into:
```js
// From a page (or other client):
await clients.setClientData({ foo: 'bar' });
```
```js
// In a service worker:
const client = (await clients.matchAll())[0];
console.log(client.data?.foo); // 'bar' or undefined.
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1475
Received on Friday, 4 October 2019 10:44:08 UTC