comparison docs/rendered/_sources/pymonkey.txt @ 53:2055d853b995

Added docs for pymonkey.Object.
author Atul Varma <varmaa@toolness.com>
date Fri, 10 Jul 2009 17:07:26 -0700
parents fabd3f2271fa
children 234fca1c4b86
comparison
equal deleted inserted replaced
52:427b01954b22 53:2055d853b995
14 .. exception:: error 14 .. exception:: error
15 15
16 This is the type of any SpiderMonkey-related errors thrown by this 16 This is the type of any SpiderMonkey-related errors thrown by this
17 module. 17 module.
18 18
19 .. class:: Object
20
21 This is the type of JavaScript objects. Such objects can only be
22 created via Pymonkey calls like :meth:`Context.new_object()` or
23 through the execution of JS code, but this type object can be used
24 with Python's built-in :func:`isinstance()` to verify that an
25 object is a JS object, like so:
26
27 >>> obj = pymonkey.Runtime().new_context().new_object()
28 >>> isinstance(obj, pymonkey.Object)
29 True
30
19 .. class:: Context 31 .. class:: Context
20 32
21 This is the type of JavaScript context objects. Contexts can only 33 This is the type of JavaScript context objects. Contexts can only
22 be created via a call to :meth:`Runtime.new_context()`, but this 34 be created via a call to :meth:`Runtime.new_context()`, but this
23 type object can be used with Python's built-in :func:`isinstance()` 35 type object can be used with Python's built-in :func:`isinstance()`
27 >>> isinstance(cx, pymonkey.Context) 39 >>> isinstance(cx, pymonkey.Context)
28 True 40 True
29 41
30 .. class:: Runtime() 42 .. class:: Runtime()
31 43
32 Creates a new JavaScript runtime. JS objects created by the 44 Creates a new JavaScript runtime. JS objects created by the runtime
33 runtime may interact with other JS objects of the runtime, but 45 may only interact with other JS objects of the same runtime.
34 they can't interact with objects from other runtimes.
35 46
36 .. method:: new_context() 47 .. method:: new_context()
37 48
38 Creates a new Context object and returns it. Contexts are best 49 Creates a new Context object and returns it. Contexts are best
39 conceptualized as threads of execution in a JS runtme; each one 50 conceptualized as threads of execution in a JS runtme; each one