Ultralight C++ API 1.3.0
|
#include <AppCore/JSHelpers.h>
JSObject wrapper that automatically manages lifetime and provides convenient access to properties.
Public Member Functions | |
JSObject () | |
Create empty Object. | |
JSObject (JSObjectRef obj) | |
Create from existing JSObjectRef from JavaScriptCore C API. | |
JSObject (const JSObject &other) | |
Copy constructor (shallow copy, will point to same instance) | |
~JSObject () | |
JSObject & | operator= (const JSObject &other) |
Assignment (shallow assignment, will point to same instance) | |
JSPropertyValue | operator[] (JSString propertyName) const |
Get a property by name. | |
bool | HasProperty (JSString propertyName) const |
Check if a property exists. | |
bool | DeleteProperty (JSString propertyName) |
Remove a property. | |
operator JSObjectRef () const | |
Get the underlying JSObjectRef (JavaScriptCore C API) | |
JSContextRef | context () const |
Get the bound context for this JSObject (it is cached at creation). | |
void | set_context (JSContextRef context) |
Set the JSContext for this JSObject. | |
Protected Member Functions | |
JSObject (JSContextRef ctx, JSValueRef val) | |
JSObject (JSContextRef ctx, JSObjectRef obj) | |
Protected Attributes | |
JSContextRef | ctx_ |
JSObjectRef | instance_ |
Friends | |
class | JSValue |
class | JSPropertyValue |
ultralight::JSObject::JSObject | ( | ) |
Create empty Object.
ultralight::JSObject::JSObject | ( | JSObjectRef | obj | ) |
Create from existing JSObjectRef from JavaScriptCore C API.
ultralight::JSObject::JSObject | ( | const JSObject & | other | ) |
Copy constructor (shallow copy, will point to same instance)
ultralight::JSObject::~JSObject | ( | ) |
|
protected |
|
protected |
|
inline |
Get the bound context for this JSObject (it is cached at creation).
bool ultralight::JSObject::DeleteProperty | ( | JSString | propertyName | ) |
Remove a property.
bool ultralight::JSObject::HasProperty | ( | JSString | propertyName | ) | const |
Check if a property exists.
|
inline |
Get the underlying JSObjectRef (JavaScriptCore C API)
Assignment (shallow assignment, will point to same instance)
JSPropertyValue ultralight::JSObject::operator[] | ( | JSString | propertyName | ) | const |
Get a property by name.
|
inline |
Set the JSContext for this JSObject.
Note: JSObjects created from within a JSCallback have a temporary JSContext that is destroyed when the callback returns. You will need to "move" any JSObjects created within these callbacks to the View's main context (call set_context() with the main context) before using them outside the callback.
|
friend |
|
friend |
|
protected |
|
protected |