Robert Carr

API Reference

The sandbox module allows the creation of isolated JSCore contexts with individual global objects. It is useful as a literal "sandbox" or in a variety of other contexts.

	sandbox = imports.sandbox;

new sandbox.Context()

Creates a new sandbox context object, which wraps a Seed JavaScript context with it's own global object. By default this global object contains only default JSCore globals (Array, Object, etc...) and has no ability to interact with the outside system. Note the context must be manually destroyed with the destroy method.


Evaluates a string source with context, returns the result.




Adds the default Seed globals to the context, including the 'Seed' global object, and the imports object.


Destroys the internal context object, and any further usage of the wrapper is an exception

A project, representing the literal global object of the context, may be freely read from and assigned to


Below are several examples of using the Seed Sandbox module. For additional resources, consult the examples/ folder of the Seed source

Example 17. 

sandbox = imports.sandbox;

ctx = new sandbox.Context();
ctx.eval("b = 2+2");
print(; //4 = new Gtk.Window(); // Possible to expose objects to the context.