[home]开源官网初始化

This commit is contained in:
tomsun28
2022-02-02 22:49:50 +08:00
parent 9347097905
commit c47706be17
132 changed files with 15971 additions and 1 deletions

17
home/src/sw.js Normal file
View File

@@ -0,0 +1,17 @@
import { registerRoute } from 'workbox-routing'
import { StaleWhileRevalidate } from 'workbox-strategies'
export default function swCustom(params) {
if (params.debug) {
console.log('[WebdriverIO-PWA][SW]: running swCustom code', params)
}
// Cache responses from external resources
registerRoute((context) => {
return [
/graph\.facebook\.com\/.*\/picture/,
/netlify\.com\/img/,
/avatars1\.githubusercontent/,
].some((regex) => context.url.href.match(regex))
}, new StaleWhileRevalidate())
}