Fixed issues around XWorker context (#1556)

This commit is contained in:
Andrea Giammarchi
2023-06-22 19:04:57 +02:00
committed by GitHub
parent f6dfc5361e
commit 3b7099cd3d
7 changed files with 38 additions and 24 deletions

View File

@@ -11,6 +11,7 @@ import {
import { getRuntimeID } from "./loader.js";
import { io } from "./interpreter/_utils.js";
import { addAllListeners } from "./listeners.js";
import { Hook } from "./worker/hooks.js";
export const CUSTOM_SELECTORS = [];
@@ -64,18 +65,9 @@ export const handleCustomType = (node) => {
onBeforeRunAsync,
onAfterRun,
onAfterRunAsync,
codeBeforeRunWorker,
codeBeforeRunWorkerAsync,
codeAfterRunWorker,
codeAfterRunWorkerAsync,
} = options;
const hooks = {
beforeRun: codeBeforeRunWorker?.(),
beforeRunAsync: codeBeforeRunWorkerAsync?.(),
afterRun: codeAfterRunWorker?.(),
afterRunAsync: codeAfterRunWorkerAsync?.(),
};
const hooks = new Hook(options);
const XWorker = function XWorker(...args) {
return Worker.apply(hooks, args);