sync xhr as a flag

This commit is contained in:
velzie 2024-09-19 20:43:26 -04:00
parent 8ad6f644e8
commit 8cbb949e21
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
3 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,12 @@ export default function (client: ScramjetClient, self: Self) {
const args = ctx.this[ARGS];
if (!args || args[2]) return;
if (!self.$scramjet.config.flags.syncxhr) {
console.warn("sync xhr disabled in flags");
return;
}
// it's a sync request
// sync xhr to service worker is not supported
// there's a nice way of polyfilling this though, we can spin on an atomic using sharedarraybuffer. this will maintain the sync behavior

View file

@ -31,6 +31,7 @@ export class ScramjetController {
serviceworkers: false,
naiiveRewriter: false,
captureErrors: true,
syncxhr: false,
cleanerrors: false,
sourcemaps: false,
},

1
src/types.d.ts vendored
View file

@ -25,6 +25,7 @@ type ScramjetFlags = {
captureErrors: boolean;
cleanerrors: boolean;
sourcemaps: boolean;
syncxhr: boolean;
};
interface ScramjetConfig {