mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 06:20:02 -04:00
fix: syncxhr and dynamic import function
This commit is contained in:
parent
7de29b7cf3
commit
3981e40deb
2 changed files with 4 additions and 2 deletions
|
@ -3,7 +3,7 @@ import { config } from "../../shared";
|
||||||
import { rewriteUrl } from "../../shared/rewriters/url";
|
import { rewriteUrl } from "../../shared/rewriters/url";
|
||||||
|
|
||||||
export default function (client: ScramjetClient, self: Self) {
|
export default function (client: ScramjetClient, self: Self) {
|
||||||
const Function = client.natives.Function;
|
const Function = client.natives["Function"];
|
||||||
|
|
||||||
self[config.globals.importfn] = function (base: string) {
|
self[config.globals.importfn] = function (base: string) {
|
||||||
return function (url: string) {
|
return function (url: string) {
|
||||||
|
|
|
@ -5,7 +5,9 @@ import { ScramjetClient } from "../../client";
|
||||||
export default function (client: ScramjetClient, self: Self) {
|
export default function (client: ScramjetClient, self: Self) {
|
||||||
let worker;
|
let worker;
|
||||||
if (self.Worker && flagEnabled("syncxhr", client.url)) {
|
if (self.Worker && flagEnabled("syncxhr", client.url)) {
|
||||||
worker = new client.natives["Worker"](config.files.sync);
|
worker = new (client.natives["Worker"] ? client.natives["Worker"] : Worker)(
|
||||||
|
config.files.sync
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const ARGS = Symbol("xhr original args");
|
const ARGS = Symbol("xhr original args");
|
||||||
const HEADERS = Symbol("xhr headers");
|
const HEADERS = Symbol("xhr headers");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue