Fix #1531 - Remove overall need for globalThis pollution (#1543)

This commit is contained in:
Andrea Giammarchi
2023-06-19 18:05:45 +02:00
committed by GitHub
parent d6b1c393f6
commit 0a7e1ce0d7
20 changed files with 83 additions and 124 deletions

View File

@@ -7,22 +7,6 @@ export const run = (interpreter, code) => interpreter.runPython(clean(code));
export const runAsync = (interpreter, code) =>
interpreter.runPythonAsync(clean(code));
export function runEvent(interpreter, code, key) {
code = `import js;event=js.__events.get(${key});${code}`;
return this.run(interpreter, code);
}
const worker = (method) =>
function (interpreter, code, xworker) {
code = `from js import xworker;${code}`;
globalThis.xworker = xworker;
return this[method](interpreter, code);
};
export const runWorker = worker("run");
export const runWorkerAsync = worker("runAsync");
export const writeFile = ({ FS }, path, buffer) =>
writeFileUtil(FS, path, buffer);
/* c8 ignore stop */