From c635d78b479510ebe2556a420948effcd30a0731 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期六, 21 十二月 2024 18:40:43 +0800 Subject: [PATCH] 新建德森项目分支 --- zy-asrs-flow/src/service-worker.js | 130 +++++++++++++++++++++--------------------- 1 files changed, 65 insertions(+), 65 deletions(-) diff --git a/zy-asrs-flow/src/service-worker.js b/zy-asrs-flow/src/service-worker.js index b86726c..41c75cf 100644 --- a/zy-asrs-flow/src/service-worker.js +++ b/zy-asrs-flow/src/service-worker.js @@ -1,65 +1,65 @@ -/* eslint-disable no-restricted-globals */ -/* eslint-disable no-underscore-dangle */ -/* globals workbox */ -workbox.core.setCacheNameDetails({ - prefix: 'antd-pro', - suffix: 'v5', -}); -// Control all opened tabs ASAP -workbox.clientsClaim(); - -/** - * Use precaching list generated by workbox in build process. - * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching - */ -workbox.precaching.precacheAndRoute(self.__precacheManifest || []); - -/** - * Register a navigation route. - * https://developers.google.com/web/tools/workbox/modules/workbox-routing#how_to_register_a_navigation_route - */ -workbox.routing.registerNavigationRoute('/index.html'); - -/** - * Use runtime cache: - * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.routing#.registerRoute - * - * Workbox provides all common caching strategies including CacheFirst, NetworkFirst etc. - * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.strategies - */ - -/** Handle API requests */ -workbox.routing.registerRoute(/\/api\//, workbox.strategies.networkFirst()); - -/** Handle third party requests */ -workbox.routing.registerRoute( - /^https:\/\/gw\.alipayobjects\.com\//, - workbox.strategies.networkFirst(), -); -workbox.routing.registerRoute( - /^https:\/\/cdnjs\.cloudflare\.com\//, - workbox.strategies.networkFirst(), -); -workbox.routing.registerRoute(/\/color.less/, workbox.strategies.networkFirst()); - -/** Response to client after skipping waiting with MessageChannel */ -addEventListener('message', (event) => { - const replyPort = event.ports[0]; - const message = event.data; - if (replyPort && message && message.type === 'skip-waiting') { - event.waitUntil( - self.skipWaiting().then( - () => { - replyPort.postMessage({ - error: null, - }); - }, - (error) => { - replyPort.postMessage({ - error, - }); - }, - ), - ); - } -}); +/* eslint-disable no-restricted-globals */ +/* eslint-disable no-underscore-dangle */ +/* globals workbox */ +workbox.core.setCacheNameDetails({ + prefix: 'antd-pro', + suffix: 'v5', +}); +// Control all opened tabs ASAP +workbox.clientsClaim(); + +/** + * Use precaching list generated by workbox in build process. + * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching + */ +workbox.precaching.precacheAndRoute(self.__precacheManifest || []); + +/** + * Register a navigation route. + * https://developers.google.com/web/tools/workbox/modules/workbox-routing#how_to_register_a_navigation_route + */ +workbox.routing.registerNavigationRoute('/index.html'); + +/** + * Use runtime cache: + * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.routing#.registerRoute + * + * Workbox provides all common caching strategies including CacheFirst, NetworkFirst etc. + * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.strategies + */ + +/** Handle API requests */ +workbox.routing.registerRoute(/\/api\//, workbox.strategies.networkFirst()); + +/** Handle third party requests */ +workbox.routing.registerRoute( + /^https:\/\/gw\.alipayobjects\.com\//, + workbox.strategies.networkFirst(), +); +workbox.routing.registerRoute( + /^https:\/\/cdnjs\.cloudflare\.com\//, + workbox.strategies.networkFirst(), +); +workbox.routing.registerRoute(/\/color.less/, workbox.strategies.networkFirst()); + +/** Response to client after skipping waiting with MessageChannel */ +addEventListener('message', (event) => { + const replyPort = event.ports[0]; + const message = event.data; + if (replyPort && message && message.type === 'skip-waiting') { + event.waitUntil( + self.skipWaiting().then( + () => { + replyPort.postMessage({ + error: null, + }); + }, + (error) => { + replyPort.postMessage({ + error, + }); + }, + ), + ); + } +}); -- Gitblit v1.9.1