Ultralight C API 1.3.0
|
Go to the source code of this file.
Data Structures | |
struct | JSStaticValue |
This structure describes a statically declared value property. More... | |
struct | JSStaticValueEx |
struct | JSStaticFunction |
This structure describes a statically declared function property. More... | |
struct | JSStaticFunctionEx |
struct | JSClassDefinition |
This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. More... | |
Functions | |
JSClassRef | JSClassCreate (const JSClassDefinition *definition) |
Creates a JavaScript class suitable for use with JSObjectMake. | |
JSClassRef | JSClassRetain (JSClassRef jsClass) |
Retains a JavaScript class. | |
void | JSClassRelease (JSClassRef jsClass) |
Releases a JavaScript class. | |
void * | JSClassGetPrivate (JSClassRef jsClass) |
Retrieves the private data from a class reference, only possible with classes created with version 1000 (extended callbacks). | |
bool | JSClassSetPrivate (JSClassRef jsClass, void *data) |
Sets the private data on a class, only possible with classes created with version 1000 (extended callbacks). | |
JSObjectRef | JSObjectMake (JSContextRef ctx, JSClassRef jsClass, void *data) |
Creates a JavaScript object. | |
JSObjectRef | JSObjectMakeFunctionWithCallback (JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) |
Convenience method for creating a JavaScript function with a given callback as its implementation. | |
JSObjectRef | JSObjectMakeConstructor (JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) |
Convenience method for creating a JavaScript constructor. | |
JSObjectRef | JSObjectMakeArray (JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) JSC_API_AVAILABLE(macos(10.6) |
Creates a JavaScript Array object. | |
JSObjectRef | ios (7.0)) |
JSObjectRef | JSObjectMakeDate (JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) JSC_API_AVAILABLE(macos(10.6) |
Creates a JavaScript Date object, as if by invoking the built-in Date constructor. | |
JSObjectRef | JSObjectMakeError (JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) JSC_API_AVAILABLE(macos(10.6) |
Creates a JavaScript Error object, as if by invoking the built-in Error constructor. | |
JSObjectRef | JSObjectMakeRegExp (JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) JSC_API_AVAILABLE(macos(10.6) |
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor. | |
JSObjectRef | JSObjectMakeDeferredPromise (JSContextRef ctx, JSObjectRef *resolve, JSObjectRef *reject, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.15) |
Creates a JavaScript promise object by invoking the provided executor. | |
JSObjectRef | ios (13.0)) |
JSObjectRef | JSObjectMakeFunction (JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef *exception) |
Creates a function with a given script as its body. | |
JSValueRef | JSObjectGetPrototype (JSContextRef ctx, JSObjectRef object) |
Gets an object's prototype. | |
void | JSObjectSetPrototype (JSContextRef ctx, JSObjectRef object, JSValueRef value) |
Sets an object's prototype. | |
bool | JSObjectHasProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) |
Tests whether an object has a given property. | |
JSValueRef | JSObjectGetProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
Gets a property from an object. | |
void | JSObjectSetProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef *exception) |
Sets a property on an object. | |
bool | JSObjectDeleteProperty (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
Deletes a property from an object. | |
bool | JSObjectHasPropertyForKey (JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.15) |
Tests whether an object has a given property using a JSValueRef as the property key. | |
JSValueRef | JSObjectGetPropertyForKey (JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.15) |
Gets a property from an object using a JSValueRef as the property key. | |
void | JSObjectSetPropertyForKey (JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef value, JSPropertyAttributes attributes, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.15) |
Sets a property on an object using a JSValueRef as the property key. | |
bool | JSObjectDeletePropertyForKey (JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.15) |
Deletes a property from an object using a JSValueRef as the property key. | |
JSValueRef | JSObjectGetPropertyAtIndex (JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef *exception) |
Gets a property from an object by numeric index. | |
void | JSObjectSetPropertyAtIndex (JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef *exception) |
Sets a property on an object by numeric index. | |
void * | JSObjectGetPrivate (JSObjectRef object) |
Gets an object's private data. | |
bool | JSObjectSetPrivate (JSObjectRef object, void *data) |
Sets a pointer to private data on an object. | |
bool | JSObjectIsFunction (JSContextRef ctx, JSObjectRef object) |
Tests whether an object can be called as a function. | |
JSValueRef | JSObjectCallAsFunction (JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
Calls an object as a function. | |
bool | JSObjectIsConstructor (JSContextRef ctx, JSObjectRef object) |
Tests whether an object can be called as a constructor. | |
JSObjectRef | JSObjectCallAsConstructor (JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
Calls an object as a constructor. | |
JSPropertyNameArrayRef | JSObjectCopyPropertyNames (JSContextRef ctx, JSObjectRef object) |
Gets the names of an object's enumerable properties. | |
JSPropertyNameArrayRef | JSPropertyNameArrayRetain (JSPropertyNameArrayRef array) |
Retains a JavaScript property name array. | |
void | JSPropertyNameArrayRelease (JSPropertyNameArrayRef array) |
Releases a JavaScript property name array. | |
size_t | JSPropertyNameArrayGetCount (JSPropertyNameArrayRef array) |
Gets a count of the number of items in a JavaScript property name array. | |
JSStringRef | JSPropertyNameArrayGetNameAtIndex (JSPropertyNameArrayRef array, size_t index) |
Gets a property name at a given index in a JavaScript property name array. | |
void | JSPropertyNameAccumulatorAddName (JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName) |
Adds a property name to a JavaScript property name accumulator. | |
Variables | |
const JSClassDefinition | kJSClassDefinitionEmpty |
A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes. | |
Typedefs | |
typedef unsigned | JSPropertyAttributes |
A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together. | |
typedef unsigned | JSClassAttributes |
A set of JSClassAttributes. Combine multiple attributes by logically ORing them together. | |
typedef void(* | JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object) |
The callback invoked when an object is first created. | |
typedef void(* | JSObjectInitializeCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object) |
typedef void(* | JSObjectFinalizeCallback) (JSObjectRef object) |
The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. | |
typedef void(* | JSObjectFinalizeCallbackEx) (JSClassRef jsClass, JSObjectRef object) |
typedef bool(* | JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) |
The callback invoked when determining whether an object has a property. | |
typedef bool(* | JSObjectHasPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName) |
typedef JSValueRef(* | JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
The callback invoked when getting a property's value. | |
typedef JSValueRef(* | JSObjectGetPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
typedef bool(* | JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef *exception) |
The callback invoked when setting a property's value. | |
typedef bool(* | JSObjectSetPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef *exception) |
typedef bool(* | JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
The callback invoked when deleting a property. | |
typedef bool(* | JSObjectDeletePropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
typedef void(* | JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) |
The callback invoked when collecting the names of an object's properties. | |
typedef void(* | JSObjectGetPropertyNamesCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) |
typedef JSValueRef(* | JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
The callback invoked when an object is called as a function. | |
typedef JSValueRef(* | JSObjectCallAsFunctionCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSStringRef className, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
typedef JSObjectRef(* | JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
The callback invoked when an object is used as a constructor in a 'new' expression. | |
typedef JSObjectRef(* | JSObjectCallAsConstructorCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
typedef bool(* | JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef *exception) |
hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. | |
typedef bool(* | JSObjectHasInstanceCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef *exception) |
typedef JSValueRef(* | JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef *exception) |
The callback invoked when converting an object to a particular JavaScript type. | |
typedef JSValueRef(* | JSObjectConvertToTypeCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSType type, JSValueRef *exception) |
Enumerations | |
enum | { kJSPropertyAttributeNone = 0 , kJSPropertyAttributeReadOnly = 1 << 1 , kJSPropertyAttributeDontEnum = 1 << 2 , kJSPropertyAttributeDontDelete = 1 << 3 } |
enum | { kJSClassAttributeNone = 0 , kJSClassAttributeNoAutomaticPrototype = 1 << 1 } |
JSValueRef ios | ( | 13. | 0 | ) |
JSObjectRef ios | ( | 7. | 0 | ) |
JSClassRef JSClassCreate | ( | const JSClassDefinition * | definition | ) |
Creates a JavaScript class suitable for use with JSObjectMake.
void * JSClassGetPrivate | ( | JSClassRef | jsClass | ) |
Retrieves the private data from a class reference, only possible with classes created with version 1000 (extended callbacks).
void JSClassRelease | ( | JSClassRef | jsClass | ) |
Releases a JavaScript class.
JSClassRef JSClassRetain | ( | JSClassRef | jsClass | ) |
Retains a JavaScript class.
bool JSClassSetPrivate | ( | JSClassRef | jsClass, |
void * | data | ||
) |
Sets the private data on a class, only possible with classes created with version 1000 (extended callbacks).
JSObjectRef JSObjectCallAsConstructor | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
size_t | argumentCount, | ||
const JSValueRef | arguments[], | ||
JSValueRef * | exception | ||
) |
Calls an object as a constructor.
JSValueRef JSObjectCallAsFunction | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSObjectRef | thisObject, | ||
size_t | argumentCount, | ||
const JSValueRef | arguments[], | ||
JSValueRef * | exception | ||
) |
Calls an object as a function.
JSPropertyNameArrayRef JSObjectCopyPropertyNames | ( | JSContextRef | ctx, |
JSObjectRef | object | ||
) |
Gets the names of an object's enumerable properties.
bool JSObjectDeleteProperty | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSStringRef | propertyName, | ||
JSValueRef * | exception | ||
) |
Deletes a property from an object.
bool JSObjectDeletePropertyForKey | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSValueRef | propertyKey, | ||
JSValueRef * | exception | ||
) |
Deletes a property from an object using a JSValueRef as the property key.
void * JSObjectGetPrivate | ( | JSObjectRef | object | ) |
Gets an object's private data.
JSValueRef JSObjectGetProperty | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSStringRef | propertyName, | ||
JSValueRef * | exception | ||
) |
Gets a property from an object.
JSValueRef JSObjectGetPropertyAtIndex | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
unsigned | propertyIndex, | ||
JSValueRef * | exception | ||
) |
Gets a property from an object by numeric index.
JSValueRef JSObjectGetPropertyForKey | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSValueRef | propertyKey, | ||
JSValueRef * | exception | ||
) |
Gets a property from an object using a JSValueRef as the property key.
JSValueRef JSObjectGetPrototype | ( | JSContextRef | ctx, |
JSObjectRef | object | ||
) |
Gets an object's prototype.
bool JSObjectHasProperty | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSStringRef | propertyName | ||
) |
Tests whether an object has a given property.
bool JSObjectHasPropertyForKey | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSValueRef | propertyKey, | ||
JSValueRef * | exception | ||
) |
Tests whether an object has a given property using a JSValueRef as the property key.
bool JSObjectIsConstructor | ( | JSContextRef | ctx, |
JSObjectRef | object | ||
) |
Tests whether an object can be called as a constructor.
bool JSObjectIsFunction | ( | JSContextRef | ctx, |
JSObjectRef | object | ||
) |
Tests whether an object can be called as a function.
JSObjectRef JSObjectMake | ( | JSContextRef | ctx, |
JSClassRef | jsClass, | ||
void * | data | ||
) |
Creates a JavaScript object.
JSObjectRef JSObjectMakeArray | ( | JSContextRef | ctx, |
size_t | argumentCount, | ||
const JSValueRef | arguments[], | ||
JSValueRef * | exception | ||
) |
Creates a JavaScript Array object.
JSObjectRef JSObjectMakeConstructor | ( | JSContextRef | ctx, |
JSClassRef | jsClass, | ||
JSObjectCallAsConstructorCallback | callAsConstructor | ||
) |
Convenience method for creating a JavaScript constructor.
JSObjectRef JSObjectMakeDate | ( | JSContextRef | ctx, |
size_t | argumentCount, | ||
const JSValueRef | arguments[], | ||
JSValueRef * | exception | ||
) |
Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
JSObjectRef JSObjectMakeDeferredPromise | ( | JSContextRef | ctx, |
JSObjectRef * | resolve, | ||
JSObjectRef * | reject, | ||
JSValueRef * | exception | ||
) |
Creates a JavaScript promise object by invoking the provided executor.
JSObjectRef JSObjectMakeError | ( | JSContextRef | ctx, |
size_t | argumentCount, | ||
const JSValueRef | arguments[], | ||
JSValueRef * | exception | ||
) |
Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
JSObjectRef JSObjectMakeFunction | ( | JSContextRef | ctx, |
JSStringRef | name, | ||
unsigned | parameterCount, | ||
const JSStringRef | parameterNames[], | ||
JSStringRef | body, | ||
JSStringRef | sourceURL, | ||
int | startingLineNumber, | ||
JSValueRef * | exception | ||
) |
Creates a function with a given script as its body.
JSObjectRef JSObjectMakeFunctionWithCallback | ( | JSContextRef | ctx, |
JSStringRef | name, | ||
JSObjectCallAsFunctionCallback | callAsFunction | ||
) |
Convenience method for creating a JavaScript function with a given callback as its implementation.
JSObjectRef JSObjectMakeRegExp | ( | JSContextRef | ctx, |
size_t | argumentCount, | ||
const JSValueRef | arguments[], | ||
JSValueRef * | exception | ||
) |
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
bool JSObjectSetPrivate | ( | JSObjectRef | object, |
void * | data | ||
) |
Sets a pointer to private data on an object.
void JSObjectSetProperty | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSStringRef | propertyName, | ||
JSValueRef | value, | ||
JSPropertyAttributes | attributes, | ||
JSValueRef * | exception | ||
) |
Sets a property on an object.
void JSObjectSetPropertyAtIndex | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
unsigned | propertyIndex, | ||
JSValueRef | value, | ||
JSValueRef * | exception | ||
) |
Sets a property on an object by numeric index.
void JSObjectSetPropertyForKey | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSValueRef | propertyKey, | ||
JSValueRef | value, | ||
JSPropertyAttributes | attributes, | ||
JSValueRef * | exception | ||
) |
Sets a property on an object using a JSValueRef as the property key.
void JSObjectSetPrototype | ( | JSContextRef | ctx, |
JSObjectRef | object, | ||
JSValueRef | value | ||
) |
Sets an object's prototype.
void JSPropertyNameAccumulatorAddName | ( | JSPropertyNameAccumulatorRef | accumulator, |
JSStringRef | propertyName | ||
) |
Adds a property name to a JavaScript property name accumulator.
size_t JSPropertyNameArrayGetCount | ( | JSPropertyNameArrayRef | array | ) |
Gets a count of the number of items in a JavaScript property name array.
JSStringRef JSPropertyNameArrayGetNameAtIndex | ( | JSPropertyNameArrayRef | array, |
size_t | index | ||
) |
Gets a property name at a given index in a JavaScript property name array.
void JSPropertyNameArrayRelease | ( | JSPropertyNameArrayRef | array | ) |
Releases a JavaScript property name array.
JSPropertyNameArrayRef JSPropertyNameArrayRetain | ( | JSPropertyNameArrayRef | array | ) |
Retains a JavaScript property name array.
|
extern |
A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes.
@const kJSClassDefinitionEmpty
Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method:
JSClassDefinition definition = kJSClassDefinitionEmpty; definition.finalize = Finalize;
typedef unsigned JSClassAttributes |
typedef JSObjectRef(* JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
The callback invoked when an object is used as a constructor in a 'new' expression.
ctx | The execution context to use. |
constructor | A JSObject that is the constructor being called. |
argumentCount | An integer count of the number of arguments in arguments. |
arguments | A JSValue array of the arguments passed to the function. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function CallAsConstructor, you would declare it like this:
JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor.
If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception.
typedef JSObjectRef(* JSObjectCallAsConstructorCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
typedef JSValueRef(* JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
The callback invoked when an object is called as a function.
ctx | The execution context to use. |
function | A JSObject that is the function being called. |
thisObject | A JSObject that is the 'this' variable in the function's scope. |
argumentCount | An integer count of the number of arguments in arguments. |
arguments | A JSValue array of the arguments passed to the function. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function CallAsFunction, you would declare it like this:
JSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
If your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject.
If this callback is NULL, calling your object as a function will throw an exception.
typedef JSValueRef(* JSObjectCallAsFunctionCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSStringRef className, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) |
typedef JSValueRef(* JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef *exception) |
The callback invoked when converting an object to a particular JavaScript type.
ctx | The execution context to use. |
object | The JSObject to convert. |
type | A JSType specifying the JavaScript type to convert to. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function ConvertToType, you would declare it like this:
JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception);
If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class).
This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself.
typedef JSValueRef(* JSObjectConvertToTypeCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSType type, JSValueRef *exception) |
typedef bool(* JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
The callback invoked when deleting a property.
ctx | The execution context to use. |
object | The JSObject in which to delete the property. |
propertyName | A JSString containing the name of the property to delete. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function DeleteProperty, you would declare it like this:
bool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
If this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class).
typedef bool(* JSObjectDeletePropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
typedef void(* JSObjectFinalizeCallback) (JSObjectRef object) |
The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
object | The JSObject being finalized. |
If you named your function Finalize, you would declare it like this:
void Finalize(JSObjectRef object);
The finalize callback is called on the most derived class first, and the least derived class (the parent class) last.
You must not call any function that may cause a garbage collection or an allocation of a garbage collected object from within a JSObjectFinalizeCallback. This includes all functions that have a JSContextRef parameter.
typedef void(* JSObjectFinalizeCallbackEx) (JSClassRef jsClass, JSObjectRef object) |
typedef JSValueRef(* JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
The callback invoked when getting a property's value.
ctx | The execution context to use. |
object | The JSObject to search for the property. |
propertyName | A JSString containing the name of the property to get. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function GetProperty, you would declare it like this:
JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
If this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.
typedef JSValueRef(* JSObjectGetPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) |
typedef void(* JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) |
The callback invoked when collecting the names of an object's properties.
ctx | The execution context to use. |
object | The JSObject whose property names are being collected. |
propertyNames | A JavaScript property name accumulator in which to accumulate the names of object's properties. |
If you named your function GetPropertyNames, you would declare it like this:
void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops.
Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently.
typedef void(* JSObjectGetPropertyNamesCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) |
typedef bool(* JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef *exception) |
hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.
ctx | The execution context to use. |
constructor | The JSObject that is the target of the 'instanceof' expression. |
possibleInstance | The JSValue being tested to determine if it is an instance of constructor. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function HasInstance, you would declare it like this:
bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue.
If this callback is NULL, 'instanceof' expressions that target your object will return false.
Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well.
typedef bool(* JSObjectHasInstanceCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef *exception) |
typedef bool(* JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) |
The callback invoked when determining whether an object has a property.
ctx | The execution context to use. |
object | The JSObject to search for the property. |
propertyName | A JSString containing the name of the property look up. |
If you named your function HasProperty, you would declare it like this:
bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
If this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.
This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive.
If this callback is NULL, the getProperty callback will be used to service hasProperty requests.
typedef bool(* JSObjectHasPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName) |
typedef void(* JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object) |
The callback invoked when an object is first created.
ctx | The execution context to use. |
object | The JSObject being created. |
If you named your function Initialize, you would declare it like this:
void Initialize(JSContextRef ctx, JSObjectRef object);
Unlike the other object callbacks, the initialize callback is called on the least derived class (the parent class) first, and the most derived class last.
typedef void(* JSObjectInitializeCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object) |
typedef bool(* JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef *exception) |
The callback invoked when setting a property's value.
ctx | The execution context to use. |
object | The JSObject on which to set the property's value. |
propertyName | A JSString containing the name of the property to set. |
value | A JSValue to use as the property's value. |
exception | A pointer to a JSValueRef in which to return an exception, if any. |
If you named your function SetProperty, you would declare it like this:
bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class).
typedef bool(* JSObjectSetPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef *exception) |
typedef unsigned JSPropertyAttributes |
anonymous enum |