EnVM2
Name inspired by EnMap.
Usage:
let storage = {};
let proc = execute({
filename: "",
dirname: "",
code: (() => {
setInterval(() => {
console.log(99);
}, 100);
}),
timeout: 100,
globals: {},
storage,
onDone: ((res) => console.log("done:", res)),
onError: ((err) => console.log("error:", err)),
autostart: false
});
// proc = {run, stop, storage, global};
/*
.stop(String reason, Bool error); // stop script (all timeouts and intervals will finish executing)
.storage; // internal `global.storage` variable access also from within the VM script
.global; // global all global variables in the script, fully modifiable but will dissapear when script stops,
.run(); // run the script
*/