Re: [w3c/ServiceWorker] Declarative routing (#1373)

After thinking about it, I think I'm going to go with the object based approach & @domenic's suggestion:

```js
// Without options:
router.add(
  conditions,
  'cache',
);

// With options:
router.add(
  conditions,
  { type: 'cache', request: '/shell.html' },
);

// Multiple sources:
router.add(
  conditions,
  [
    'cache',
    'network',
    { type: 'cache', request: '/shell.html' },
  ],
);
```

I'm still not keen on having objects with a required property that determines the type of the object, but it seems better than the alternatives.

-- 
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/1373#issuecomment-452683477

Received on Wednesday, 9 January 2019 12:43:23 UTC