Skip to content

Commit 3b9873f

Browse files
address #76
1 parent b3c535a commit 3b9873f

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

static/hypertabs/index.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,37 @@
1515
<script src="../libcurl/index.js"></script>
1616
<script src="../baremux/index.js" defer></script>
1717
<script>
18-
(async () => {
19-
if ('serviceWorker' in navigator) {
20-
await navigator.serviceWorker.register('/sw.js', {
21-
scope: '/sw/',
22-
}).then(async () => {
23-
const connection = new BareMux.BareMuxConnection("/baremux/worker.js")
24-
let transport = localStorage.getItem('transport') || "/epoxy/index.mjs"
25-
// Feel free to remove this, its just for skids to stop making issues on it
26-
if (window.location.origin.includes('.pages.dev')) {
27-
console.log('your static hosting, using TOMP Wisp Server.')
28-
let wispserver = "wss://tomp.app/wisp"
29-
await connection.setTransport(transport, [{ wisp: wispserver }]);
30-
} else {
31-
console.log('Using Backend Wisp Server, if your static hosting just delete these lines bellow and uncomment out the text bellow')
32-
//let wispserver = "wss://tomp.app/wisp" Uncomment if static hosting
33-
let wispserver = `${window.location.origin.replace(/^https?:\/\//, 'ws://')}/wisp/`
34-
await connection.setTransport(transport, [{ wisp: wispserver }]);
35-
}
36-
});
18+
window.addEventListener("load", async () => {
19+
if ('serviceWorker' in navigator) {
20+
await navigator.serviceWorker.register('/sw.js', {
21+
scope: '/sw/',
22+
}).then(async () => {
23+
const connection = new BareMux.BareMuxConnection("/baremux/worker.js")
24+
let transport = localStorage.getItem('transport') || "/epoxy/index.mjs"
25+
// Feel free to remove this, its just for skids to stop making issues on it
26+
if (window.location.origin.includes('.pages.dev')) {
27+
console.log('your static hosting, using TOMP Wisp Server.')
28+
let wispserver = "wss://tomp.app/wisp"
29+
await connection.setTransport(transport, [{ wisp: wispserver }]);
30+
} else {
31+
console.log('Using Backend Wisp Server, if your static hosting just delete these lines bellow and uncomment out the text bellow')
32+
//let wispserver = "wss://tomp.app/wisp" Uncomment if static hosting
33+
let wispserver = `${window.location.origin.replace(/^https?:\/\//, 'ws://')}/wisp/`
34+
await connection.setTransport(transport, [{ wisp: wispserver }]);
35+
}
36+
});
3737

38-
await navigator.serviceWorker.register('/dynsw.js', {
39-
scope: '/dyn/',
40-
});
38+
await navigator.serviceWorker.register('/dynsw.js', {
39+
scope: '/dyn/',
40+
});
4141
}
4242

4343
if (!localStorage.getItem('HTfirstRun')) {
4444
console.log('kongsole')
4545
localStorage.setItem('HTfirstRun', false)
4646
window.location.reload()
4747
}
48-
})();
48+
})
4949

5050
// check custom functions
5151
document.addEventListener('keydown', key => {

static/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<script src="index.js" defer></script>
1616
<script src="/js/tabs.js" defer></script>
1717
<script>
18-
(async () => {
18+
window.addEventListener("load", async () => {
1919
if ('serviceWorker' in navigator) {
2020
await navigator.serviceWorker.register('/sw.js', {
2121
scope: '/sw/',
@@ -45,7 +45,7 @@
4545
localStorage.setItem('HTfirstRun', false)
4646
window.location.reload()
4747
}
48-
})();
48+
})
4949
</script>
5050
</head>
5151
<body tabindex="-1" oncontextmenu="return false;" class="noSelect" id="no" data-notification="false">

0 commit comments

Comments
 (0)