Mercurial > pymonkey
annotate docs/rendered/_sources/pymonkey.txt @ 144:ab612d2ad96a
Updated docs to reflect new script members.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 24 Aug 2009 22:47:15 -0700 |
parents | 96dc1beefc00 |
children | 0b1020c817b3 |
rev | line source |
---|---|
51
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
1 :mod:`pymonkey` --- Access SpiderMonkey from Python |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
2 =================================================== |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
3 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
4 .. module:: pymonkey |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
5 :synopsis: Access SpiderMonkey from Python |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
6 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
7 .. testsetup:: * |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
8 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
9 import pymonkey |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
10 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
11 This module offers a low-level interface to the `Mozilla SpiderMonkey |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
12 <https://developer.mozilla.org/en/SpiderMonkey>`_ JavaScript engine. |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
13 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
14 .. exception:: error |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
15 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
16 This is the type of any SpiderMonkey-related errors thrown by this |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
17 module. |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
18 |
54
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
19 .. data:: undefined |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
20 |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
21 This is the singleton that represents the JavaScript value |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
22 ``undefined``, as Python has no equivalent representation |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
23 (JavaScript's ``null`` is mapped to Python's ``None`` object). |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
24 For instance: |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
25 |
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
26 >>> cx = pymonkey.Runtime().new_context() |
56
72e84bd75905
Made another doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
55
diff
changeset
|
27 >>> cx.evaluate_script(cx.new_object(), '', '<string>', 1) |
57
a2b617731398
pymonkey.undefined now has a 'falsy' value.
Atul Varma <varmaa@toolness.com>
parents:
56
diff
changeset
|
28 pymonkey.undefined |
54
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
29 |
57
a2b617731398
pymonkey.undefined now has a 'falsy' value.
Atul Varma <varmaa@toolness.com>
parents:
56
diff
changeset
|
30 This object also has a "falsy" value: |
54
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
31 |
57
a2b617731398
pymonkey.undefined now has a 'falsy' value.
Atul Varma <varmaa@toolness.com>
parents:
56
diff
changeset
|
32 >>> if not pymonkey.undefined: |
a2b617731398
pymonkey.undefined now has a 'falsy' value.
Atul Varma <varmaa@toolness.com>
parents:
56
diff
changeset
|
33 ... print "See, it's falsy!" |
a2b617731398
pymonkey.undefined now has a 'falsy' value.
Atul Varma <varmaa@toolness.com>
parents:
56
diff
changeset
|
34 See, it's falsy! |
54
234fca1c4b86
Added docs for pymonkey.undefined.
Atul Varma <varmaa@toolness.com>
parents:
53
diff
changeset
|
35 |
53
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
36 .. class:: Object |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
37 |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
38 This is the type of JavaScript objects. Such objects can only be |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
39 created via Pymonkey calls like :meth:`Context.new_object()` or |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
40 through the execution of JS code, but this type object can be used |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
41 with Python's built-in :func:`isinstance()` to verify that an |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
42 object is a JS object, like so: |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
43 |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
44 >>> obj = pymonkey.Runtime().new_context().new_object() |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
45 >>> isinstance(obj, pymonkey.Object) |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
46 True |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
47 |
78
c48b393f6461
Added docs for Object.get_runtime().
Atul Varma <varmaa@toolness.com>
parents:
58
diff
changeset
|
48 .. method:: get_runtime() |
c48b393f6461
Added docs for Object.get_runtime().
Atul Varma <varmaa@toolness.com>
parents:
58
diff
changeset
|
49 |
c48b393f6461
Added docs for Object.get_runtime().
Atul Varma <varmaa@toolness.com>
parents:
58
diff
changeset
|
50 Returns the :class:`Runtime` that the object belongs to. |
c48b393f6461
Added docs for Object.get_runtime().
Atul Varma <varmaa@toolness.com>
parents:
58
diff
changeset
|
51 |
85 | 52 .. class:: Function |
53 | |
54 This is the type of JavaScript functions, which is a subtype of | |
55 :class:`Object`. | |
56 | |
139
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
57 .. class:: Script |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
58 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
59 This is the type of compiled JavaScript scripts; it's actually a |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
60 subtype of :class:`Object`, though when exposed to JS code it |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
61 doesn't provide access to any special data or functionality. |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
62 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
63 Script instances have a read-only buffer interface that exposes |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
64 their bytecode. This can be accessed by passing an instance to |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
65 Python's built-in ``buffer()`` function. |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
66 |
144
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
67 .. data:: filename |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
68 |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
69 The filename of the script's original source code. |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
70 |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
71 .. data:: base_lineno |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
72 |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
73 The line number at which the script's original source code |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
74 begins. |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
75 |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
76 .. data:: line_extent |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
77 |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
78 The number of lines comprising the original source code. |
ab612d2ad96a
Updated docs to reflect new script members.
Atul Varma <varmaa@toolness.com>
parents:
141
diff
changeset
|
79 |
51
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
80 .. class:: Context |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
81 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
82 This is the type of JavaScript context objects. Contexts can only |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
83 be created via a call to :meth:`Runtime.new_context()`, but this |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
84 type object can be used with Python's built-in :func:`isinstance()` |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
85 to verify that an object is a context, like so: |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
86 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
87 >>> cx = pymonkey.Runtime().new_context() |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
88 >>> isinstance(cx, pymonkey.Context) |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
89 True |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
90 |
130
4705522c7431
Added notes about weak-referencability to docs.
Atul Varma <varmaa@toolness.com>
parents:
119
diff
changeset
|
91 JS contexts are weak-referencable. |
4705522c7431
Added notes about weak-referencability to docs.
Atul Varma <varmaa@toolness.com>
parents:
119
diff
changeset
|
92 |
58
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
93 .. method:: get_runtime() |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
94 |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
95 Returns the :class:`Runtime` that the context belongs to. |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
96 |
79
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
97 .. method:: new_object([private_obj]) |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
98 |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
99 Creates a new :class:`Object` instance and returns |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
100 it. ``private_obj`` is any Python object that is privately |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
101 stored within the new JS object; it can be retrieved using |
80 | 102 :meth:`get_object_private()`. |
58
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
103 |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
104 .. method:: new_function(func, name) |
85 | 105 |
106 Creates a new :class:`Function` instance that wraps the | |
90 | 107 given Python callable. In JS-land, the function will |
85 | 108 have the given name. |
109 | |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
110 When the function is executed from JavaScript, `func` |
90 | 111 will be passed three positional arguments. |
112 | |
113 The first argument is a :class:`Context` that represents the | |
114 JS context which is calling the function. | |
115 | |
116 The second argument is an :class:`Object` that represents the | |
117 value of ``this`` for the duration of the call. | |
118 | |
119 The third argument is a tuple containing the arguments | |
120 passed to the function. | |
121 | |
111 | 122 For instance: |
123 | |
124 >>> def add(cx, this, args): | |
125 ... return args[0] + args[1] | |
126 >>> cx = pymonkey.Runtime().new_context() | |
127 >>> obj = cx.new_object() | |
128 >>> cx.define_property(obj, 'add', cx.new_function(add, 'add')) | |
129 >>> cx.evaluate_script(obj, 'add(1, 1);', '<string>', 1) | |
130 2 | |
131 | |
114
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
132 .. method:: define_property(object, name, value) |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
133 |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
134 Creates a new property on `object`, bypassing any JavaScript setters. |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
135 |
134
0c81cb18c935
Added docs for context.has_property().
Atul Varma <varmaa@toolness.com>
parents:
130
diff
changeset
|
136 .. method:: has_property(object, name) |
0c81cb18c935
Added docs for context.has_property().
Atul Varma <varmaa@toolness.com>
parents:
130
diff
changeset
|
137 |
0c81cb18c935
Added docs for context.has_property().
Atul Varma <varmaa@toolness.com>
parents:
130
diff
changeset
|
138 Returns whether or not `object` has the specified property. |
0c81cb18c935
Added docs for context.has_property().
Atul Varma <varmaa@toolness.com>
parents:
130
diff
changeset
|
139 |
114
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
140 .. method:: get_property(object, name) |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
141 |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
142 Finds the specified property on `object` and returns its value, |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
143 possibly invoking a JavaScript getter. |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
144 |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
145 Example: |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
146 |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
147 >>> cx = pymonkey.Runtime().new_context() |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
148 >>> obj = cx.new_object() |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
149 >>> cx.define_property(obj, 'beets', 'i like beets.') |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
150 >>> cx.get_property(obj, 'beets') |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
151 u'i like beets.' |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
152 |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
153 Note also that calling this function on undefined properties |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
154 yields :data:`undefined`: |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
155 |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
156 >>> cx.get_property(obj, 'carrots') |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
157 pymonkey.undefined |
87147faa031a
Added docs for define_property() and get_property().
Atul Varma <varmaa@toolness.com>
parents:
113
diff
changeset
|
158 |
79
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
159 .. method:: get_object_private(object) |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
160 |
80 | 161 Returns the ``private_obj`` passed to :meth:`new_object()` |
79
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
162 when `object` was first created. If it doesn't exist, ``None`` |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
163 is returned. |
228a56e7e793
Added docs for context.get_object_private().
Atul Varma <varmaa@toolness.com>
parents:
78
diff
changeset
|
164 |
85 | 165 If `object` was created with :meth:`new_function()`, then this |
166 method returns the Python callable wrapped by `object`. | |
167 | |
90 | 168 This functionality is useful if you want to securely represent |
169 Python objects in JS-land. | |
58
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
170 |
85 | 171 .. method:: clear_object_private(object) |
172 | |
173 Clears the ``private_obj`` passed to :meth:`new_object()` | |
174 when `object` was first created. If it doesn't exist, this | |
175 function returns nothing. | |
176 | |
177 If `object` was created with :meth:`new_function()`, then this | |
178 method effectively "unbinds" the Python callable wrapped by | |
179 `object`. If `object` is later called, an exception will be | |
180 raised. | |
181 | |
90 | 182 .. method:: evaluate_script(globalobj, code, filename, lineno) |
183 | |
184 Evaluates the text `code` using `globalobj` as the global | |
185 object/scope. | |
186 | |
187 It's assumed that `code` is coming from the file named by `filename`; | |
188 the first line of `code` is assumed to be line number `lineno` of | |
189 `filename`. This metadata is very useful for debugging stack traces, | |
190 exceptions, and so forth. | |
191 | |
113
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
192 For example: |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
193 |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
194 >>> cx = pymonkey.Runtime().new_context() |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
195 >>> obj = cx.new_object() |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
196 >>> cx.init_standard_classes(obj) |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
197 >>> cx.evaluate_script(obj, '5 * Math', '<string>', 1) |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
198 nan |
e616b4605db0
Added doctest for evaluate_script().
Atul Varma <varmaa@toolness.com>
parents:
112
diff
changeset
|
199 |
141 | 200 .. method:: compile_script(code, filename, lineno) |
139
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
201 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
202 Compiles the given string of code and returns a :class:`Script` |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
203 instance that can be executed via :meth:`execute_script()`. |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
204 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
205 `filename` and `lineno` are used just as in |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
206 :meth:`evaluate_script()`. |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
207 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
208 .. method:: execute_script(globalobj, script) |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
209 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
210 Executes the code in the given :class:`Script` object, using |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
211 `globalobj` as the global object/scope, and returns the result. |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
212 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
213 For example: |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
214 |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
215 >>> cx = pymonkey.Runtime().new_context() |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
216 >>> obj = cx.new_object() |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
217 >>> cx.init_standard_classes(obj) |
141 | 218 >>> script = cx.compile_script('5 * Math', '<string>', 1) |
139
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
219 >>> cx.execute_script(obj, script) |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
220 nan |
d08cb5a06c66
Added docs for Script, compile_script() and execute_script().
Atul Varma <varmaa@toolness.com>
parents:
134
diff
changeset
|
221 |
90 | 222 .. method:: call_function(thisobj, func, args) |
223 | |
224 Calls a JavaScript function. | |
225 | |
226 `thisobj` is an :class:`Object` that will be used as the value | |
227 of ``this`` when the function executes, `func` is the | |
228 :class:`Function` to execute, and `args` is a tuple of arguments | |
229 to pass to the function. | |
230 | |
112
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
231 For instance: |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
232 |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
233 >>> cx = pymonkey.Runtime().new_context() |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
234 >>> obj = cx.new_object() |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
235 >>> cx.init_standard_classes(obj) |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
236 >>> Math = cx.get_property(obj, 'Math') |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
237 >>> floor = cx.get_property(Math, 'floor') |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
238 >>> cx.call_function(Math, floor, (5.3,)) |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
239 5 |
2086377c0abe
Added doctest for call_function().
Atul Varma <varmaa@toolness.com>
parents:
111
diff
changeset
|
240 |
58
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
241 .. method:: init_standard_classes(object) |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
242 |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
243 Defines the standard JavaScript classes on the given |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
244 :class:`Object`, such as ``Array``, ``eval``, ``undefined``, and |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
245 so forth. For more information, see the documentation to |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
246 `JS_InitStandardClasses() |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
247 <https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_InitStandardClasses>`_, |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
248 which this method wraps. |
7a3461ccaf1d
Added documentation for Context methods get_runtime(), new_object(), and init_standard_classes().
Atul Varma <varmaa@toolness.com>
parents:
57
diff
changeset
|
249 |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
250 .. method:: gc() |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
251 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
252 Performs garbage collection on the context's JavaScript runtime. |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
253 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
254 .. method:: set_operation_callback(func) |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
255 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
256 Sets the operation callback for the context to the given Python |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
257 callable. The callback can be triggered via |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
258 :meth:`trigger_operation_callback()`. |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
259 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
260 `func` takes one argument: the context that triggered it. |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
261 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
262 .. method:: trigger_operation_callback() |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
263 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
264 Triggers the context's operation callback. If no callback has |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
265 yet been set, this function does nothing. |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
266 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
267 This function is one of the few thread-safe functions available |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
268 to a JS runtime, and together with |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
269 :meth:`set_operation_callback()` can be used to abort the |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
270 execution of long-running code. |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
271 |
116
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
272 For instance, we first create an operation callback to stop |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
273 long-running code by throwing an exception: |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
274 |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
275 >>> import time, threading |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
276 >>> cx = pymonkey.Runtime().new_context() |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
277 >>> def stop_running_code(cx): |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
278 ... raise Exception('JS took too long to execute.') |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
279 >>> cx.set_operation_callback(stop_running_code) |
116
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
280 |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
281 Then we create a watchdog thread to trigger the operation |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
282 callback once a long amount of time has passed: |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
283 |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
284 >>> def watchdog_thread(): |
116
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
285 ... time.sleep(0.1) # An eternity to a computer! |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
286 ... cx.trigger_operation_callback() |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
287 >>> thread = threading.Thread(target=watchdog_thread) |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
288 >>> thread.start() |
116
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
289 |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
290 Now, when we execute code that takes too long to run, it gets |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
291 aborted: |
06269ca0b36c
Made the operation callback doctest easier to read.
Atul Varma <varmaa@toolness.com>
parents:
115
diff
changeset
|
292 |
115
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
293 >>> try: |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
294 ... cx.evaluate_script(cx.new_object(), 'while (1) {}', |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
295 ... '<string>', 1) |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
296 ... except pymonkey.error, e: |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
297 ... print cx.get_object_private(e.args[0]) |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
298 JS took too long to execute. |
f4c550369332
Added documentation for gc() and operation callback functions.
Atul Varma <varmaa@toolness.com>
parents:
114
diff
changeset
|
299 |
51
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
300 .. class:: Runtime() |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
301 |
53
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
302 Creates a new JavaScript runtime. JS objects created by the runtime |
2055d853b995
Added docs for pymonkey.Object.
Atul Varma <varmaa@toolness.com>
parents:
51
diff
changeset
|
303 may only interact with other JS objects of the same runtime. |
51
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
304 |
119
d30576edf797
Added notes on thread safety to documentation.
Atul Varma <varmaa@toolness.com>
parents:
116
diff
changeset
|
305 With few exceptions, objects belonging to a runtime can currently |
d30576edf797
Added notes on thread safety to documentation.
Atul Varma <varmaa@toolness.com>
parents:
116
diff
changeset
|
306 only be used in the same thread that the runtime was created |
d30576edf797
Added notes on thread safety to documentation.
Atul Varma <varmaa@toolness.com>
parents:
116
diff
changeset
|
307 in. This may be changed in the future, since SpiderMonkey itself |
d30576edf797
Added notes on thread safety to documentation.
Atul Varma <varmaa@toolness.com>
parents:
116
diff
changeset
|
308 has support for thread safety. |
d30576edf797
Added notes on thread safety to documentation.
Atul Varma <varmaa@toolness.com>
parents:
116
diff
changeset
|
309 |
130
4705522c7431
Added notes about weak-referencability to docs.
Atul Varma <varmaa@toolness.com>
parents:
119
diff
changeset
|
310 JS runtimes are weak-referencable. |
4705522c7431
Added notes about weak-referencability to docs.
Atul Varma <varmaa@toolness.com>
parents:
119
diff
changeset
|
311 |
51
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
312 .. method:: new_context() |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
313 |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
314 Creates a new Context object and returns it. Contexts are best |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
315 conceptualized as threads of execution in a JS runtme; each one |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
316 has a program counter, a current exception state, and so |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
317 forth. JS objects may be freely accessed and changed by contexts |
fabd3f2271fa
Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
318 that are associated with the same JS runtime as the objects. |