JSContext
Overview
JSContext is a class in Aspose.Html FOSS for Python.
A JavaScript execution context backed by QuickJS, pre-wired to a DOM.
This class provides 6 methods for working with JSContext objects in Python programs.
Available methods include: __init__, close, eval_module, evaluate, import_stub, register_module.
All public members are accessible to any Python application after installing the Aspose.Html FOSS for Python package.
Methods
| Signature | Description |
|---|---|
__init__(document: "Document") | Calls init(document) on this JSContext instance. |
register_module(specifier: str, source: str) | Register an ES module source string under specifier. |
eval_module(source: str, module_name: str) → Any | Evaluate source as an ES module in the QuickJS context. |
import_stub(specifier: str) | Unconditionally raise NotImplementedError for dynamic import(). |
evaluate(js_source: str) → Any | Evaluate js_source in the QuickJS context. |
close() | Release the QuickJS runtime resources. |