Skip to content

Lcfvs/Sandbox.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sandbox.js

A JavaScript sandboxing

This project is a Web workers alternative under the LGPL 3.0 license (http://www.gnu.org/licenses/lgpl-3.0.txt).

It allows you to create several different threads (knowing window & window.document), each with its own execution context.

Each window has its own sandbox and isn't affected by the prototyping defined by scripts that run outside the current sandbox.

Syntax :

new Sandbox(src, callbackName, onReadyStateChange);

Arguments :

[required] String src : the script url
[optional] String callbackName : the closure name
[optional] Function onReadyStateChange : the function listening to the sandbox readyState

The Sandbox properties :

String src : the script url
String callbackName : the closure name ('anonymous' if not specified)
Window window : the sandbox window context
Function onreadystatechange( callback ) : the function listening to the sandbox readyState
Integer readyState : the sandbox readyState (0 to 4)

The readyState :

0 : initialisation
1 : creation of a iframe tag
2 : the iframe is loaded
3 : creation of a script tag
4 : the script is loaded & callable

Compatibility :

Firefox 3.5+
IE 7+
Chrome
Safari
Opera

About

A JavaScript sanboxing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published