Re: [w3c/ServiceWorker] Need for a mechanism to detect supported conditions and sources in the SW Static Routing API (Issue #1793)

yoshisatoyanagisawa left a comment (w3c/ServiceWorker#1793)

Thanks for the reply.  To be clear, actual code to check the supported condition might be:

```
function isNewPropertySupported(installEvent, propertyName) {
  const newPropertyError = new Error('newPropertyError');
  const conditionWithNewProperty = { };
  Object.defineProperty(conditionWithNewProperty, propertyName, {
    get: function() { throw newPropertyError; }
  });
  const throwingCondition = {
    get urlPattern() { throw new Error('expectedError'); }
  };
  const routes = [
    {
      condition: conditionWithNewProperty,
      source: "network"
    },
    {
      condition: throwingCondition,
      source: "network"
    }];
  return installEvent.addRoutes(routes).catch(e => {
    return e === newPropertyError;
  });
}
```

Yeah, we assume the urlPattern condition and the network source are always supported.

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

Message ID: <w3c/ServiceWorker/issues/1793/3573917087@github.com>

Received on Tuesday, 25 November 2025 06:09:45 UTC