direct.p3d.JavaScript
from direct.p3d.JavaScript import BrowserObject, ConcreteStruct, MethodWrapper, UndefinedObject
This module defines some simple classes and instances which are useful when writing code that integrates with JavaScript, especially code that runs in a browser via the web plugin.
Deprecated since version 1.10.0: The browser plug-in is no longer supported.
Inheritance diagram
- class BrowserObject(runner, objectId)[source]
Bases:
object
This class provides the Python wrapper around some object that actually exists in the plugin host’s namespace, e.g. a JavaScript or DOM object.
- class ConcreteStruct[source]
Bases:
object
Python objects that inherit from this class are passed to JavaScript as a concrete struct: a mapping from string -> value, with no methods, passed by value. This can be more optimal than traditional Python objects which are passed by reference, especially for small objects which might be repeatedly referenced on the JavaScript side.
- class MethodWrapper(runner, parentObj, objectId)[source]
Bases:
object
This is a Python wrapper around a property of a BrowserObject that doesn’t appear to be a first-class object in the Python sense, but is nonetheless a callable method.
- class UndefinedObject[source]
Bases:
object
This is a special object that is returned by the browser to represent an “undefined” or “void” value, typically the value for an uninitialized variable or undefined property. It has no attributes, similar to None, but it is a slightly different concept in JavaScript.