Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createCollectRoutes = (bgSyncPlugin: BackgroundSyncPlugin) => {
const match = ({url}: RouteMatchCallbackOptions) =>
url.hostname === GOOGLE_ANALYTICS_HOST &&
COLLECT_PATHS_REGEX.test(url.pathname);
const handler = new NetworkOnly({
plugins: [bgSyncPlugin],
});
return [
new Route(match, handler, 'GET'),
new Route(match, handler, 'POST'),
];
};