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

youennf left a comment (w3c/ServiceWorker#1793)

FWIW, the getter hack short term solution (for newly introduced properties) would be something like:
```
function isNewPropertySupported(propertyName) {
  const newPropertyError = new Error('newPropertyError');
  const routeWithNewProperty = { };
  Object.defineProperty(routeWithNewProperty, propertyName, {
    get: function() { throw newPropertyError; }
  });
  const throwingRoute = {
    get urlPattern() { throw new Error('expectedError'); }
  };
  return installEvent.addRoutes([routeWithNewProperty, throwingRoute]).catch(e => {
    return e === newPropertyError;
  });
}
```

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

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

Received on Monday, 24 November 2025 08:56:30 UTC