Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.
/ JS-Sandbox Public archive

A pure Javascript library for code evalutation in limited and isolated context (waiting for a native implementation)

License

Notifications You must be signed in to change notification settings

AceOfWands/JS-Sandbox

Repository files navigation

JS-Sandbox

A pure Javascript library for code evalutation in limited and isolated context

Start to use

First install as dependencies by your package manager

npm install js-sandbox

Now you import the module js-sandbox in your code

import Sandbox from 'js-sandbox';

Once imported you can instantiate a Sandbox objects where to run your code.

API

Sandbox

  • constructor ( dom, context )
    • dom: a DOM element to use as document variable for code executed into the Sandbox.
    • context: object to use as windows for code executed into the Sandbox.
  • execCode ( code [, newContext ] )
    • code: javascript code to execute in the Sandbox.
    • newContext: a new object to use as window for code executed into the Sandbox instead of context passed to the constructor.
  • execFunction ( func, args [, newContext ] )
    • func: function to execute in the Sandbox.
    • args: ordered array of arguments for the function.
    • newContext: a new object to use as window for code executed into the Sandbox instead of context passed to the constructor.
  • execMethod ( method, args, obj )
    • method: the name of method to execute.
    • args: ordered array of arguments for the method.
    • obj: the object to use as this which prototype has method requested otherwise a SandboxException will be raise.

About

A pure Javascript library for code evalutation in limited and isolated context (waiting for a native implementation)

Resources

License

Stars

Watchers

Forks

Packages

No packages published