threads 🚀🚀🚀

This commit is contained in:
velzie 2024-07-16 16:54:39 -04:00
parent b06605dc52
commit d433f67d67
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
8 changed files with 179 additions and 26 deletions

View file

@ -1,10 +1,21 @@
navigator.serviceWorker
.register("./sw.js", {
scope: $scramjet.config.prefix,
})
.then((reg) => {
reg.update();
});
.register("./sw.js")
.then((reg) => {
reg.update();
});
navigator.serviceWorker.ready.then((reg) => {
for (let i = 0; i < 20; i++) {
const thread = new SharedWorker($scramjet.config.thread, { name: "thread" + i });
reg.active.postMessage({
scramjet$type: "add",
handle: thread.port
}, [thread.port]);
}
});
const connection = new BareMux.BareMuxConnection("/baremux/worker.js");
const flex = css`
display: flex;
@ -13,21 +24,21 @@ const col = css`
flex-direction: column;
`;
const store = $store(
{
url: "https://google.com",
wispurl: "wss://wisp.mercurywork.shop/",
bareurl:
(location.protocol === "https:" ? "https" : "http") +
"://" +
location.host +
"/bare/",
},
{ ident: "settings", backing: "localstorage", autosave: "auto" }
{
url: "https://google.com",
wispurl: "wss://wisp.mercurywork.shop/",
bareurl:
(location.protocol === "https:" ? "https" : "http") +
"://" +
location.host +
"/bare/",
},
{ ident: "settings", backing: "localstorage", autosave: "auto" }
);
connection.setTransport("/baremod/index.mjs", [store.bareurl]);
function App() {
this.urlencoded = "";
this.css = `
this.urlencoded = "";
this.css = `
width: 100%;
height: 100%;
color: #e0def4;
@ -86,7 +97,7 @@ function App() {
}
`;
return html`
return html`
<div>
<h1>Percury Unblocker</h1>
<p>surf the unblocked and mostly buggy web</p>
@ -110,5 +121,5 @@ function App() {
}
window.addEventListener("load", () => {
document.body.appendChild(h(App));
document.body.appendChild(h(App));
});