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

SignatureDescription
__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)AnyEvaluate source as an ES module in the QuickJS context.
import_stub(specifier: str)Unconditionally raise NotImplementedError for dynamic import().
evaluate(js_source: str)AnyEvaluate js_source in the QuickJS context.
close()Release the QuickJS runtime resources.

See Also