mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 23:10:02 -04:00
threads 🚀🚀🚀
This commit is contained in:
parent
b06605dc52
commit
d433f67d67
8 changed files with 179 additions and 26 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue