Force reload in examples. (#974)

After installing the service worker to use the COOP/COEP header, ensure
the document is reloaded.

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/973
Fixed:https://github.com/ArthurSonzogni/FTXUI/issues/973
This commit is contained in:
Arthur Sonzogni 2024-12-25 13:32:35 +01:00 committed by GitHub
parent daa421fa6a
commit 751c8fab26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,9 +6,7 @@ import xterm_addon_fit from 'https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.5.
if ("serviceWorker" in navigator && !window.crossOriginIsolated) {
const url_sw = new URL("./sw.js", location.href);
const registration = await navigator.serviceWorker.register(url_sw);
if (registration.active && !navigator.serviceWorker.controller) {
window.location.reload(); // Reload to ensure the COOP/COEP headers are set.
}
window.location.reload(); // Reload to ensure the COOP/COEP headers are set.
}
const example_list = "@EXAMPLES@".split(";");