[next] Rename all runtime(s) references to interpreter(s) (#1536)

This commit is contained in:
Andrea Giammarchi
2023-06-15 15:34:07 +02:00
committed by GitHub
parent db27d52352
commit 6284c02032
21 changed files with 214 additions and 198 deletions

View File

@@ -0,0 +1,28 @@
import { clean, writeFile as writeFileUtil } from "./_utils.js";
// REQUIRES INTEGRATION TEST
/* c8 ignore start */
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 */