sandbox-webworker

1.0.4 • Public • Published

sandbox-webworker

A js sandbox based on web worker

Install

$ npm install sandbox-webworker

Usage

import sandbox from 'sandbox-webworker';

async function test(expression, scope) {
  return await sandbox.evaluate(expression, scope);
}

const expression = 'a+b';
const scope = { a: 1, b: 2 };
test(expression, scope)
  .then(res => {
    console.log(res);
  })
  .catch(err => {
    console.log(err);
  });

Licence

MIT

/sandbox-webworker/

    Package Sidebar

    Install

    npm i sandbox-webworker

    Weekly Downloads

    5

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    32.1 kB

    Total Files

    23

    Last publish

    Collaborators

    • zhennann