Ultralight C++ API 1.4.0
|
#include <AppCore/JSHelpers.h>
JSFunction wrapper that automatically manages lifetime and provides convenient function invocation operators.
Public Member Functions | |
JSFunction () | |
Create an empty Function. | |
JSFunction (const JSFunction &other) | |
Copy constructor (shallow copy, will point to same instance) | |
~JSFunction () | |
JSFunction & | operator= (const JSFunction &other) |
Assignment (shallow assignment, will point to same instance) | |
bool | IsValid () const |
Whether or not this is a valid, callable Function object. | |
JSValue | operator() (const JSArgs &args) |
Call function (using Global Object for 'this') and return the result. | |
JSValue | operator() (const JSObject &thisObject, const JSArgs &args) |
Call function (with explicit object for 'this') and return the result. | |
operator JSObjectRef () const | |
Get the underlying JSObjectRef (JavaScriptCore C API) | |
JSContextRef | context () const |
Get the bound context for this JSFunction (it is cached at creation). | |
void | set_context (JSContextRef context) |
Set the JSContext for this JSFunction. | |
Protected Member Functions | |
JSFunction (JSContextRef ctx, JSValueRef val) | |
Protected Attributes | |
JSContextRef | ctx_ |
JSObjectRef | instance_ |
Friends | |
class | JSValue |
JSFunction | ( | ) |
Create an empty Function.
NOTE: It is OKAY to create this without calling SetJSContext() first.
JSFunction | ( | const JSFunction & | other | ) |
Copy constructor (shallow copy, will point to same instance)
~JSFunction | ( | ) |
|
protected |
|
inline |
Get the bound context for this JSFunction (it is cached at creation).
bool IsValid | ( | ) | const |
Whether or not this is a valid, callable Function object.
|
inline |
Get the underlying JSObjectRef (JavaScriptCore C API)
Call function (using Global Object for 'this') and return the result.
Call function (with explicit object for 'this') and return the result.
JSFunction & operator= | ( | const JSFunction & | other | ) |
Assignment (shallow assignment, will point to same instance)
|
inline |
Set the JSContext for this JSFunction.
|
friend |
|
protected |
|
protected |