feat: new experimental Strategies export
This commit is contained in:
parent
2e94226b1c
commit
0c8d5edd77
4 changed files with 18 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
import { defineConfig } from "astro/config";
|
||||
import node from "@astrojs/node";
|
||||
import serviceWorker from "./packages/index.js";
|
||||
import { Strategies } from "./packages/strategies/index.js";
|
||||
|
||||
export default defineConfig({
|
||||
output: "hybrid",
|
||||
|
@ -32,6 +33,9 @@ export default defineConfig({
|
|||
const sw = await navigator.serviceWorker.getRegistration();
|
||||
console.log('>>> registrered', sw)
|
||||
}
|
||||
},
|
||||
experimental: {
|
||||
strategy: Strategies.CacheRevalidatePreloadFallback,
|
||||
}
|
||||
})
|
||||
]
|
||||
|
|
|
@ -33,6 +33,14 @@ const ASTROSW = '@ayco/astro-sw';
|
|||
* unsupported?: () => void,
|
||||
* afterRegistration?: () => void,
|
||||
* }
|
||||
* experimental?: {
|
||||
* strategy?: {
|
||||
* fetchFn: () => void,
|
||||
* installFn: () => void,
|
||||
* activateFn: () => void,
|
||||
* waitFn: () => void,
|
||||
* }
|
||||
* }
|
||||
* }} options
|
||||
* @returns {AstroIntegration}
|
||||
*/
|
||||
|
|
|
@ -142,7 +142,7 @@ const fetchFn = (event) => {
|
|||
|
||||
const waitFn = (event) => {}
|
||||
|
||||
export default {
|
||||
export const CacheRevalidatePreloadFallback = {
|
||||
fetchFn,
|
||||
installFn,
|
||||
activateFn,
|
||||
|
|
5
packages/strategies/index.js
Normal file
5
packages/strategies/index.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { CacheRevalidatePreloadFallback } from "./CacheRevalidatePreloadFallback.js";
|
||||
|
||||
export const Strategies = {
|
||||
CacheRevalidatePreloadFallback
|
||||
}
|
Loading…
Reference in a new issue