1.0.7 • Published 3 years ago

sandbox-brower v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

sandboxjs

A nifty javascript sandbox for browser. When its dispose is called, all defined global variables will be destroyed,Includes timers and global events.

Installing it

npm install sandbox-brower

Using it

const sandbox = new Sandbox();
const scriptText = 'window.customName = "jay"; console.log(window.customName);' ;
sandbox.execScript(scriptText); // 'jay'
sandbox.dispose(); // destroy the sandbox
console.log(window.customName); // undefined

other

If you have some variables defined on window outside the sandbox, you can still use them inside the sandbox

window.globalProp = 'hello world'
const sandbox = new Sandbox();
const scriptText = 'console.log(window.globalProp);' ; 
sandbox.execScript(scriptText);// 'hello world'
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago