comparison docs/rendered/pymonkey.html @ 51:fabd3f2271fa

Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
author Atul Varma <varmaa@toolness.com>
date Wed, 08 Jul 2009 09:32:31 -0700
parents
children 2055d853b995
comparison
equal deleted inserted replaced
50:405f03166009 51:fabd3f2271fa
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
8 <title>pymonkey — Access SpiderMonkey from Python &mdash; Pymonkey v0.0.1 documentation</title>
9 <link rel="stylesheet" href="_static/default.css" type="text/css" />
10 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
11 <script type="text/javascript">
12 var DOCUMENTATION_OPTIONS = {
13 URL_ROOT: '',
14 VERSION: '0.0.1',
15 COLLAPSE_MODINDEX: false,
16 FILE_SUFFIX: '.html',
17 HAS_SOURCE: true
18 };
19 </script>
20 <script type="text/javascript" src="_static/jquery.js"></script>
21 <script type="text/javascript" src="_static/doctools.js"></script>
22 <link rel="top" title="Pymonkey v0.0.1 documentation" href="index.html" />
23 <link rel="prev" title="Pymonkey Documentation" href="index.html" />
24 </head>
25 <body>
26 <div class="related">
27 <h3>Navigation</h3>
28 <ul>
29 <li class="right" style="margin-right: 10px">
30 <a href="genindex.html" title="General Index"
31 accesskey="I">index</a></li>
32 <li class="right" >
33 <a href="modindex.html" title="Global Module Index"
34 accesskey="M">modules</a> |</li>
35 <li class="right" >
36 <a href="index.html" title="Pymonkey Documentation"
37 accesskey="P">previous</a> |</li>
38 <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li>
39 </ul>
40 </div>
41
42 <div class="document">
43 <div class="documentwrapper">
44 <div class="bodywrapper">
45 <div class="body">
46
47 <div class="section" id="module-pymonkey">
48 <h1><tt class="xref docutils literal"><span class="pre">pymonkey</span></tt> &#8212; Access SpiderMonkey from Python<a class="headerlink" href="#module-pymonkey" title="Permalink to this headline">¶</a></h1>
49 <p>This module offers a low-level interface to the <a class="reference" href="https://developer.mozilla.org/en/SpiderMonkey">Mozilla SpiderMonkey</a> JavaScript engine.</p>
50 <dl class="exception">
51 <dt id="pymonkey.error">
52 <em class="property">
53 exception </em><tt class="descclassname">pymonkey.</tt><tt class="descname">error</tt><a class="headerlink" href="#pymonkey.error" title="Permalink to this definition">¶</a></dt>
54 <dd>This is the type of any SpiderMonkey-related errors thrown by this
55 module.</dd></dl>
56
57 <dl class="class">
58 <dt id="pymonkey.Context">
59 <em class="property">
60 class </em><tt class="descclassname">pymonkey.</tt><tt class="descname">Context</tt><a class="headerlink" href="#pymonkey.Context" title="Permalink to this definition">¶</a></dt>
61 <dd><p>This is the type of JavaScript context objects. Contexts can only
62 be created via a call to <a title="pymonkey.Runtime.new_context" class="reference" href="#pymonkey.Runtime.new_context"><tt class="xref docutils literal"><span class="pre">Runtime.new_context()</span></tt></a>, but this
63 type object can be used with Python&#8217;s built-in <tt class="xref docutils literal"><span class="pre">isinstance()</span></tt>
64 to verify that an object is a context, like so:</p>
65 <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">cx</span> <span class="o">=</span> <span class="n">pymonkey</span><span class="o">.</span><span class="n">Runtime</span><span class="p">()</span><span class="o">.</span><span class="n">new_context</span><span class="p">()</span>
66 <span class="gp">&gt;&gt;&gt; </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span> <span class="n">pymonkey</span><span class="o">.</span><span class="n">Context</span><span class="p">)</span>
67 <span class="go">True</span>
68 </pre></div>
69 </div>
70 </dd></dl>
71
72 <dl class="class">
73 <dt id="pymonkey.Runtime">
74 <em class="property">
75 class </em><tt class="descclassname">pymonkey.</tt><tt class="descname">Runtime</tt><a class="headerlink" href="#pymonkey.Runtime" title="Permalink to this definition">¶</a></dt>
76 <dd><p>Creates a new JavaScript runtime. JS objects created by the
77 runtime may interact with other JS objects of the runtime, but
78 they can&#8217;t interact with objects from other runtimes.</p>
79 <dl class="method">
80 <dt id="pymonkey.Runtime.new_context">
81 <tt class="descname">new_context</tt><big>(</big><big>)</big><a class="headerlink" href="#pymonkey.Runtime.new_context" title="Permalink to this definition">¶</a></dt>
82 <dd>Creates a new Context object and returns it. Contexts are best
83 conceptualized as threads of execution in a JS runtme; each one
84 has a program counter, a current exception state, and so
85 forth. JS objects may be freely accessed and changed by contexts
86 that are associated with the same JS runtime as the objects.</dd></dl>
87
88 </dd></dl>
89
90 </div>
91
92
93 </div>
94 </div>
95 </div>
96 <div class="sphinxsidebar">
97 <div class="sphinxsidebarwrapper">
98 <h4>Previous topic</h4>
99 <p class="topless"><a href="index.html"
100 title="previous chapter">Pymonkey Documentation</a></p>
101 <h3>This Page</h3>
102 <ul class="this-page-menu">
103 <li><a href="_sources/pymonkey.txt"
104 rel="nofollow">Show Source</a></li>
105 </ul>
106 <div id="searchbox" style="display: none">
107 <h3>Quick search</h3>
108 <form class="search" action="search.html" method="get">
109 <input type="text" name="q" size="18" />
110 <input type="submit" value="Go" />
111 <input type="hidden" name="check_keywords" value="yes" />
112 <input type="hidden" name="area" value="default" />
113 </form>
114 <p class="searchtip" style="font-size: 90%">
115 Enter search terms or a module, class or function name.
116 </p>
117 </div>
118 <script type="text/javascript">$('#searchbox').show(0);</script>
119 </div>
120 </div>
121 <div class="clearer"></div>
122 </div>
123 <div class="related">
124 <h3>Navigation</h3>
125 <ul>
126 <li class="right" style="margin-right: 10px">
127 <a href="genindex.html" title="General Index"
128 >index</a></li>
129 <li class="right" >
130 <a href="modindex.html" title="Global Module Index"
131 >modules</a> |</li>
132 <li class="right" >
133 <a href="index.html" title="Pymonkey Documentation"
134 >previous</a> |</li>
135 <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li>
136 </ul>
137 </div>
138 <div class="footer">
139 &copy; Copyright 2009, Atul Varma.
140 Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
141 </div>
142 </body>
143 </html>