File: sandbox.xml

package info (click to toggle)
seed 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,900 kB
  • sloc: ansic: 24,336; sh: 11,196; makefile: 773; xml: 187; python: 173
file content (43 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?xml version="1.0"?>
<chapter id="Sandbox-module" xmlns:xi="http://www.w3.org/2003/XInclude">
    <chapterinfo>
    <author>
      <firstname>Robert</firstname>
      <surname>Carr</surname>
      <affiliation>
	<address>
	  <email>racarr@<parameter>gnome.org</parameter></email>
	</address>
      </affiliation>
    </author>
  </chapterinfo>
  <title>Sandbox</title>

  <refsect1>
    <title>API Reference</title>
    <para>
      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. 
      <programlisting>
	sandbox = imports.sandbox;
      </programlisting>
    </para>
    
    <xi:include href="sandbox-funcs.xml"/>
  </refsect1>
  <refsect1>
    <title>Examples</title>
    <para>Below are several examples of using the Seed Sandbox module. For additional resources, consult the examples/ folder of the Seed source</para>
    <example id="sandbox-example">
      <programlisting>
sandbox = imports.sandbox;

ctx = new sandbox.Context();
ctx.eval("b = 2+2");
print(ctx.global.b); //4
ctx.global.b = new Gtk.Window(); // Possible to expose objects to the context.
ctx.eval("b.show()");
      </programlisting>
    </example>
  </refsect1>
</chapter>