Mercurial > pymonkey
view 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 |
line wrap: on
line source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>pymonkey — Access SpiderMonkey from Python — Pymonkey v0.0.1 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '0.0.1', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="Pymonkey v0.0.1 documentation" href="index.html" /> <link rel="prev" title="Pymonkey Documentation" href="index.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li> <li class="right" > <a href="index.html" title="Pymonkey Documentation" accesskey="P">previous</a> |</li> <li><a href="index.html">Pymonkey v0.0.1 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-pymonkey"> <h1><tt class="xref docutils literal"><span class="pre">pymonkey</span></tt> — Access SpiderMonkey from Python<a class="headerlink" href="#module-pymonkey" title="Permalink to this headline">¶</a></h1> <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> <dl class="exception"> <dt id="pymonkey.error"> <em class="property"> 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> <dd>This is the type of any SpiderMonkey-related errors thrown by this module.</dd></dl> <dl class="class"> <dt id="pymonkey.Context"> <em class="property"> 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> <dd><p>This is the type of JavaScript context objects. Contexts can only 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 type object can be used with Python’s built-in <tt class="xref docutils literal"><span class="pre">isinstance()</span></tt> to verify that an object is a context, like so:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </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> <span class="gp">>>> </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> <span class="go">True</span> </pre></div> </div> </dd></dl> <dl class="class"> <dt id="pymonkey.Runtime"> <em class="property"> 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> <dd><p>Creates a new JavaScript runtime. JS objects created by the runtime may interact with other JS objects of the runtime, but they can’t interact with objects from other runtimes.</p> <dl class="method"> <dt id="pymonkey.Runtime.new_context"> <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> <dd>Creates a new Context object and returns it. Contexts are best conceptualized as threads of execution in a JS runtme; each one has a program counter, a current exception state, and so forth. JS objects may be freely accessed and changed by contexts that are associated with the same JS runtime as the objects.</dd></dl> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="index.html" title="previous chapter">Pymonkey Documentation</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/pymonkey.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="modindex.html" title="Global Module Index" >modules</a> |</li> <li class="right" > <a href="index.html" title="Pymonkey Documentation" >previous</a> |</li> <li><a href="index.html">Pymonkey v0.0.1 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009, Atul Varma. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2. </div> </body> </html>