An object that represents a loaded javascript object and its global context.
This object is already loaded in memory and is persistent as long as the Python object exists.
A Simple Example - Creating a Python-JS Interface
Javascript Object can be Incrementally Extended
Public Member Functions | |
virtual bool | contains (const QVariant &propName) const |
Checks the if the object contains a given property at key or at value if the object is an array. More... | |
virtual void | remove (const QVariant &propValue) const |
Removes a property from the object at key or at value if the object is an array. For removing at index on arrays, use pop() method instead. | |
virtual QVariant | pop (int propIdx) const |
Pops a property from the array object at index. More... | |
virtual void | insert (int propIdx, const QVariant &propValue) const |
Inserts a property in the middle of arrays. | |
virtual void | clear () const |
Clears the object of any property. | |
virtual void | append (const QVariant &propValue) const |
Appends a property to the end of an array. | |
QVariant | call (const QVariant &arguments=QVariant(), const QVariant &selfValue=QVariant()) |
Calls the javascript function with the provided arguments and an object representing the object bound to the self at the function's execution. More... | |
Public Attributes | |
QString | source |
The source of the javascript object – the file path if loaded from a file, otherwise from memory. | |
QString | type |
Identifies the type of this object as a string value. | |
QVariant OMC::JavascriptObject::call | ( | const QVariant & | arguments = QVariant() , |
const QVariant & | selfValue = QVariant() |
||
) |
Calls the javascript function with the provided arguments and an object representing the object bound to the self at the function's execution.
arguments | - A list of arguments provided to the function being called. If the function is defined with named-arguments, the arguments will use those names. |
selfValue | - An object that is bound to the function when called. This object is available with the 'this' object in the context of the function. |
Calling a function with 'this' object bound
|
virtual |
Checks the if the object contains a given property at key or at value if the object is an array.
Introspecting a JS Object
|
virtual |
Pops a property from the array object at index.