PythonMonkey   v1.0.1 (dev)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pythonmonkey.pythonmonkey Namespace Reference

Classes

class  bigint
 
class  EvalOptions
 
class  JSArrayIterProxy
 
class  JSArrayProxy
 
class  JSFunctionProxy
 
class  JSMethodProxy
 
class  JSObjectProxy
 
class  JSStringProxy
 
class  SpiderMonkeyError
 

Functions

_typing.Any eval (str code, EvalOptions evalOpts={})
 
JSObjectProxy require (str moduleIdentifier)
 
_typing.Callable[..., _typing.Any] new (JSFunctionProxy ctor)
 
 typeof (_typing.Any jsval)
 
_typing.Awaitable[None] wait ()
 
None stop ()
 
None runProgramModule (str filename, _typing.List[str] argv, _typing.List[str] extraPaths=[])
 
bool isCompilableUnit (str code)
 
None collect ()
 
JSObjectProxy internalBinding (str namespace)
 

Variables

 null
 
 globalThis
 

Detailed Description

stub file for type hints & documentations for the native module
@see https://typing.readthedocs.io/en/latest/source/stubs.html

Function Documentation

◆ collect()

None pythonmonkey.pythonmonkey.collect ( )
Calls the spidermonkey garbage collector

◆ eval()

_typing.Any pythonmonkey.pythonmonkey.eval ( str  code,
EvalOptions   evalOpts = {} 
)
JavaScript evaluator in Python

◆ internalBinding()

JSObjectProxy pythonmonkey.pythonmonkey.internalBinding ( str  namespace)
INTERNAL USE ONLY

See function declarations in ./builtin_modules/internal-binding.d.ts

◆ isCompilableUnit()

bool pythonmonkey.pythonmonkey.isCompilableUnit ( str  code)
Hint if a string might be compilable Javascript without actual evaluation

◆ new()

_typing.Callable[..., _typing.Any] pythonmonkey.pythonmonkey.new ( JSFunctionProxy  ctor)
Wrap the JS new operator, emitting a lambda which constructs a new
JS object upon invocation

◆ require()

JSObjectProxy pythonmonkey.pythonmonkey.require ( str  moduleIdentifier)
Return the exports of a CommonJS module identified by `moduleIdentifier`, using standard CommonJS semantics

◆ runProgramModule()

None pythonmonkey.pythonmonkey.runProgramModule ( str  filename,
_typing.List[str]  argv,
_typing.List[str]   extraPaths = [] 
)
Load and evaluate a program (main) module. Program modules must be written in JavaScript.

◆ stop()

None pythonmonkey.pythonmonkey.stop ( )
Stop all pending asynchronous jobs, and unblock `await pm.wait()`

◆ typeof()

pythonmonkey.pythonmonkey.typeof ( _typing.Any  jsval)
This is the JS `typeof` operator, wrapped in a function so that it can be used easily from Python.

◆ wait()

_typing.Awaitable[None] pythonmonkey.pythonmonkey.wait ( )
Block until all asynchronous jobs (Promise/setTimeout/etc.) finish.

```py
await pm.wait()
```

This is the event-loop shield that protects the loop from being prematurely terminated.

Variable Documentation

◆ globalThis

pythonmonkey.pythonmonkey.globalThis
Initial value:
1= _typing.Annotated[
2 JSObjectProxy,
3 "A Python Dict which is equivalent to the globalThis object in JavaScript",
4]

◆ null

pythonmonkey.pythonmonkey.null
Initial value:
1= _typing.Annotated[
2 _typing.NewType("pythonmonkey.null", object),
3 "Representing the JS null type in Python using a singleton object",
4]