scriptcontext
provides a disposable sandbox for scripts
WARNING: its only protected via vm
it doesn't start a new child process. it will not protect you against while(1);
how to use
const EventEmitter = ;const scriptContext = ;const emitter = ;const config =resolve:consoleobject:consolesubscribe:emitter;const scripts =file: 'filename (optional)'content: 'const objectFunc = resolve("object.func"); objectFunc();'content: 'const func = resolve("func"); subscribe("emitter.event", func);';const context = ;// console prints `object.func`emitter;// console prints `func`context;
scriptcontext(config, scripts)
config
see lib/provider
- `resolve` <Object>
- `scriptEvent` <Boolean>
- `scriptFn` <Boolean>
- `subscribe` <Object>
- `onError` <Function>
- `timeout` <Boolean>
scripts
install
npm install scriptcontext --save