Skip to content

zhennann/sandbox-webworker

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published