pymonkey — Access SpiderMonkey from Python

This module offers a low-level interface to the Mozilla SpiderMonkey JavaScript engine.

exception pymonkey.error
This is the type of any SpiderMonkey-related errors thrown by this module.
class pymonkey.Context

This is the type of JavaScript context objects. Contexts can only be created via a call to Runtime.new_context(), but this type object can be used with Python’s built-in isinstance() to verify that an object is a context, like so:

>>> cx = pymonkey.Runtime().new_context()
>>> isinstance(cx, pymonkey.Context)
True
class pymonkey.Runtime

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.

new_context()
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.

Previous topic

Pymonkey Documentation

This Page