Re: [slightlyoff/ServiceWorker] consider allowing multiple worker thread instances for a single registration (#756)

@wheresrhys seems like a singleton-style pattern would be better:

```js
const getFlags = (() => {
  let cacheTime;
  let cachedFlags;

  return function getFlags() {
    if (cachedFlags & Date.now() - cacheTime < 1000 * 60 * 5) {
      return Promise.resolve(cachedFlags);
    }
    return getFlagsFromIDB().then(flags => {
      cachedFlags = flags;
      cacheTime = Date.now();
      return cachedFlags;
    });
  };
})();
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/756#issuecomment-238028525

Received on Saturday, 6 August 2016 15:23:01 UTC