comparison docs/rendered/pymonkey.html @ 58:7a3461ccaf1d

Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
author Atul Varma <varmaa@toolness.com>
date Sun, 19 Jul 2009 19:58:15 -0700
parents a2b617731398
children c48b393f6461
comparison
equal deleted inserted replaced
57:a2b617731398 58:7a3461ccaf1d
77 <dl class="class"> 77 <dl class="class">
78 <dt id="pymonkey.Object"> 78 <dt id="pymonkey.Object">
79 <em class="property"> 79 <em class="property">
80 class </em><tt class="descclassname">pymonkey.</tt><tt class="descname">Object</tt><a class="headerlink" href="#pymonkey.Object" title="Permalink to this definition">¶</a></dt> 80 class </em><tt class="descclassname">pymonkey.</tt><tt class="descname">Object</tt><a class="headerlink" href="#pymonkey.Object" title="Permalink to this definition">¶</a></dt>
81 <dd><p>This is the type of JavaScript objects. Such objects can only be 81 <dd><p>This is the type of JavaScript objects. Such objects can only be
82 created via Pymonkey calls like <tt class="xref docutils literal"><span class="pre">Context.new_object()</span></tt> or 82 created via Pymonkey calls like <a title="pymonkey.Context.new_object" class="reference" href="#pymonkey.Context.new_object"><tt class="xref docutils literal"><span class="pre">Context.new_object()</span></tt></a> or
83 through the execution of JS code, but this type object can be used 83 through the execution of JS code, but this type object can be used
84 with Python&#8217;s built-in <tt class="xref docutils literal"><span class="pre">isinstance()</span></tt> to verify that an 84 with Python&#8217;s built-in <tt class="xref docutils literal"><span class="pre">isinstance()</span></tt> to verify that an
85 object is a JS object, like so:</p> 85 object is a JS object, like so:</p>
86 <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">obj</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="o">.</span><span class="n">new_object</span><span class="p">()</span> 86 <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">obj</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="o">.</span><span class="n">new_object</span><span class="p">()</span>
87 <span class="gp">&gt;&gt;&gt; </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">pymonkey</span><span class="o">.</span><span class="n">Object</span><span class="p">)</span> 87 <span class="gp">&gt;&gt;&gt; </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">pymonkey</span><span class="o">.</span><span class="n">Object</span><span class="p">)</span>
101 <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> 101 <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>
102 <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> 102 <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>
103 <span class="go">True</span> 103 <span class="go">True</span>
104 </pre></div> 104 </pre></div>
105 </div> 105 </div>
106 <dl class="method">
107 <dt id="pymonkey.Context.get_runtime">
108 <tt class="descname">get_runtime</tt><big>(</big><big>)</big><a class="headerlink" href="#pymonkey.Context.get_runtime" title="Permalink to this definition">¶</a></dt>
109 <dd>Returns the <a title="pymonkey.Runtime" class="reference" href="#pymonkey.Runtime"><tt class="xref docutils literal"><span class="pre">Runtime</span></tt></a> that the context belongs to.</dd></dl>
110
111 <dl class="method">
112 <dt id="pymonkey.Context.new_object">
113 <tt class="descname">new_object</tt><big>(</big><big>)</big><a class="headerlink" href="#pymonkey.Context.new_object" title="Permalink to this definition">¶</a></dt>
114 <dd>Creates a new <a title="pymonkey.Object" class="reference" href="#pymonkey.Object"><tt class="xref docutils literal"><span class="pre">Object</span></tt></a> instance and returns it.</dd></dl>
115
116 <dl class="method">
117 <dt id="pymonkey.Context.init_standard_classes">
118 <tt class="descname">init_standard_classes</tt><big>(</big><em>object</em><big>)</big><a class="headerlink" href="#pymonkey.Context.init_standard_classes" title="Permalink to this definition">¶</a></dt>
119 <dd>Defines the standard JavaScript classes on the given
120 <a title="pymonkey.Object" class="reference" href="#pymonkey.Object"><tt class="xref docutils literal"><span class="pre">Object</span></tt></a>, such as <tt class="docutils literal"><span class="pre">Array</span></tt>, <tt class="docutils literal"><span class="pre">eval</span></tt>, <tt class="docutils literal"><span class="pre">undefined</span></tt>, and
121 so forth. For more information, see the documentation to
122 <a class="reference" href="https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_InitStandardClasses">JS_InitStandardClasses()</a>,
123 which this method wraps.</dd></dl>
124
106 </dd></dl> 125 </dd></dl>
107 126
108 <dl class="class"> 127 <dl class="class">
109 <dt id="pymonkey.Runtime"> 128 <dt id="pymonkey.Runtime">
110 <em class="property"> 129 <em class="property">