Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxence-charriere committed Jun 15, 2024
1 parent f37706a commit ab2c53a
Show file tree
Hide file tree
Showing 25 changed files with 1,572 additions and 1,685 deletions.
160 changes: 77 additions & 83 deletions docs/actions.html

Large diffs are not rendered by default.

66 changes: 36 additions & 30 deletions docs/app-worker.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
const cacheName = "app-" + "91fb0a689c4e65cba6e9e4c88de038ac0354c031";
// -----------------------------------------------------------------------------
// PWA
// -----------------------------------------------------------------------------
const cacheName = "app-" + "45ce0d586872985c88bc19ef48ab5fe0a4c45485";
const resourcesToCache = ["/","/app.css","/app.js","/manifest.webmanifest","/wasm_exec.js","/web/app.wasm","/web/css/docs.css","/web/css/prism.css","/web/documents/home-next.md","/web/documents/home.md","/web/documents/updates.md","/web/documents/what-is-go-app.md","/web/js/prism.js","https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1013306768105236","https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.png"];

self.addEventListener("install", (event) => {
console.log("installing app worker 91fb0a689c4e65cba6e9e4c88de038ac0354c031");

event.waitUntil(
caches
.open(cacheName)
.then((cache) => {
return cache.addAll(resourcesToCache);
})
.then(() => {
self.skipWaiting();
})
);
console.log("installing app worker 45ce0d586872985c88bc19ef48ab5fe0a4c45485");
event.waitUntil(installWorker());
});

async function installWorker() {
const cache = await caches.open(cacheName);
await cache.addAll(resourcesToCache);
await self.skipWaiting(); // Use this new service worker
}

self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((keyList) => {
return Promise.all(
keyList.map((key) => {
if (key !== cacheName) {
return caches.delete(key);
}
})
);
})
);
console.log("app worker 91fb0a689c4e65cba6e9e4c88de038ac0354c031 is activated");
event.waitUntil(deletePreviousCaches());
console.log("app worker 45ce0d586872985c88bc19ef48ab5fe0a4c45485 is activated");
});

async function deletePreviousCaches() {
keys = await caches.keys();
keys.forEach(async (key) => {
if (key != cacheName) {
console.log("deleting", key, "cache");
await caches.delete(key);
}
});
}

self.addEventListener("fetch", (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
event.respondWith(fetchWithCache(event.request));
});

async function fetchWithCache(request) {
cachedResponse = await caches.match(request);
if (cachedResponse) {
return cachedResponse;
}
return fetch(request);
}

// -----------------------------------------------------------------------------
// Push Notifications
// -----------------------------------------------------------------------------
self.addEventListener("push", (event) => {
if (!event.data || !event.data.text()) {
return;
Expand Down
25 changes: 13 additions & 12 deletions docs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var goappOnAppInstallChange = function () {
goappAppInstallChangedBeforeWasmLoaded = true;
};

const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"/","GOAPP_STATIC_RESOURCES_URL":"/web","GOAPP_VERSION":"91fb0a689c4e65cba6e9e4c88de038ac0354c031"};
const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"/","GOAPP_STATIC_RESOURCES_URL":"/web","GOAPP_VERSION":"45ce0d586872985c88bc19ef48ab5fe0a4c45485"};
const goappLoadingLabel = "go-app documentation {progress}%";
const goappWasmContentLength = "";
const goappWasmContentLengthHeader = "";
Expand All @@ -31,17 +31,18 @@ goappInitWebAssembly();
// -----------------------------------------------------------------------------
async function goappInitServiceWorker() {
if ("serviceWorker" in navigator) {
try {
const registration = await navigator.serviceWorker.register(
"/app-worker.js"
);

goappServiceWorkerRegistration = registration;
goappSetupNotifyUpdate(registration);
goappSetupPushNotification();
} catch (err) {
console.error("goapp service worker registration failed", err);
}
window.addEventListener("load", async () => {
try {
const registration = await navigator.serviceWorker.register(
"/app-worker.js"
);
goappServiceWorkerRegistration = registration;
goappSetupNotifyUpdate(registration);
goappSetupPushNotification();
} catch (err) {
console.error("goapp service worker registration failed: ", err);
}
});
}
}

Expand Down
162 changes: 78 additions & 84 deletions docs/architecture.html

Large diffs are not rendered by default.

178 changes: 86 additions & 92 deletions docs/components.html

Large diffs are not rendered by default.

136 changes: 65 additions & 71 deletions docs/concurrency.html

Large diffs are not rendered by default.

Loading

0 comments on commit ab2c53a

Please sign in to comment.