return fake serviceworkerregistration

This commit is contained in:
velzie 2024-07-21 16:20:52 -04:00
parent 91dc2f96cd
commit f2fe8c1d5e
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
5 changed files with 87 additions and 2 deletions

21
src/client/swruntime.ts Normal file
View file

@ -0,0 +1,21 @@
import { encodeUrl } from "../shared/rewriters/url";
class ScramjetServiceWorkerRuntime {
constructor() {
addEventListener("message", (event) => {
if ("scramjet$type" in event.data) {
event.stopImmediatePropagation();
return;
}
});
}
}
declare global {
interface Window {
ScramjetServiceWorkerRuntime: typeof ScramjetServiceWorkerRuntime;
}
}
self.ScramjetServiceWorkerRuntime = ScramjetServiceWorkerRuntime;