mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-17 16:10:02 -04:00
feat: add helper functions to natives store + refac
This commit is contained in:
parent
70f0315791
commit
ef8735f95a
6 changed files with 164 additions and 121 deletions
|
@ -5,7 +5,7 @@ import { ScramjetClient } from "../../client";
|
|||
export default function (client: ScramjetClient, self: Self) {
|
||||
let worker;
|
||||
if (self.Worker && flagEnabled("syncxhr", client.url)) {
|
||||
worker = new client.natives["Worker"](config.files.sync);
|
||||
worker = client.natives.construct("Worker", config.files.sync);
|
||||
}
|
||||
const ARGS = Symbol("xhr original args");
|
||||
const HEADERS = Symbol("xhr headers");
|
||||
|
@ -44,7 +44,7 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
const sab = new SharedArrayBuffer(1024, { maxByteLength: 2147483647 });
|
||||
const view = new DataView(sab);
|
||||
|
||||
client.natives["Worker.prototype.postMessage"].call(worker, {
|
||||
client.natives.call("Worker.prototype.postMessage", worker, {
|
||||
sab,
|
||||
args,
|
||||
headers: ctx.this[HEADERS],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue