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,20 +1,24 @@
import { swfetch } from "./fetch";
import { ScramjetThreadpool } from "./threadpool";
declare global {
interface Window {
ScramjetServiceWorker;
ScramjetThread;
}
}
export class ScramjetServiceWorker {
client: typeof self.$scramjet.shared.util.BareClient.prototype;
config: typeof self.$scramjet.config;
threadpool: ScramjetThreadpool;
constructor(config = self.$scramjet.config) {
this.client = new self.$scramjet.shared.util.BareClient();
if (!config.prefix) config.prefix = "/scramjet/";
this.config = config;
this.threadpool = new ScramjetThreadpool();
}
route({ request }: FetchEvent) {
@ -27,6 +31,4 @@ export class ScramjetServiceWorker {
};
self.ScramjetServiceWorker = ScramjetServiceWorker;