Re: [w3c/ServiceWorker] Provide a way to attach data to clients (#1475)

We could add `getClientData`, but I wonder if it would encourage racing:

```js
clients.getClientData().then(data => {
  data.hello = 'world';
  clients.setClientData(data);
});
// …
clients.getClientData().then(data => {
  data.foo = 'baz';
  clients.setClientData(data);
});
```

We could ask folks to use weblocks, but if they're going to do coordination like that, they may as well just coordinate on a state object.

```js
import stateData from './state.mjs';

stateData.hello = 'world';
clients.setClientData(stateData);
// …
stateData.foo = 'baz';
clients.setClientData(stateData);
```

-- 
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#issuecomment-538348980

Received on Friday, 4 October 2019 10:50:34 UTC