chore: move example_sw.js to src
This commit is contained in:
parent
574c14fb13
commit
13978f8380
3 changed files with 4 additions and 6 deletions
|
@ -78,7 +78,7 @@ The integration accepts a configuration object of type `ServiceWorkerConfig` wit
|
||||||
|
|
||||||
## Example sw.js
|
## Example sw.js
|
||||||
|
|
||||||
You can find an example service worker (`example_sw.js`) in the [repository](https://ayco.io/gh/astro-sw).
|
You can find an example service worker (`src/example_sw.js`) in the [repository](https://ayco.io/gh/astro-sw).
|
||||||
|
|
||||||
## Background
|
## Background
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default defineConfig({
|
||||||
site: 'https://ayo.ayco.io',
|
site: 'https://ayo.ayco.io',
|
||||||
integrations: [
|
integrations: [
|
||||||
serviceWorker({
|
serviceWorker({
|
||||||
path: './example_sw.js',
|
path: './src/example_sw.js',
|
||||||
customRoutes: [
|
customRoutes: [
|
||||||
// '/threads'
|
// '/threads'
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { log } from "./src/utils";
|
import { log } from "./utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: @ayco/astro-sw integration injects variables `__prefix`, `__version`, & `__assets`
|
* Note: @ayco/astro-sw integration injects variables `__prefix`, `__version`, & `__assets`
|
||||||
|
@ -78,9 +78,7 @@ self.addEventListener('activate', (event) => {
|
||||||
self.addEventListener('install', (event) => {
|
self.addEventListener('install', (event) => {
|
||||||
console.log('installing...', event)
|
console.log('installing...', event)
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
addResourcesToCache([
|
addResourcesToCache(__assets ?? [])
|
||||||
...(__assets ?? [])
|
|
||||||
])
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue