envm2

1.1.4 • Public • Published

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
*/

Readme

Keywords

none

Package Sidebar

Install

npm i envm2

Weekly Downloads

0

Version

1.1.4

License

MIT

Unpacked Size

6.72 kB

Total Files

3

Last publish

Collaborators

  • cryogena