struct JSStaticFunction
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.
The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time.
typedef JSObjectCallAsConstructorCallback
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.
@result A JSObject that is the constructor's return value.
If you named your function CallAsConstructor, you would declare it like this:
typedef JSObjectCallAsFunctionCallback
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.
@result A JSValue that is the function's return value.
If you named your function CallAsFunction, you would declare it like this:
typedef JSObjectDeletePropertyCallback
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.
@result true if propertyName was successfully deleted, otherwise false.
If you named your function DeleteProperty, you would declare it like this:
typedef JSObjectFinalizeCallback
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:
typedef JSObjectGetPropertyCallback
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.
@result The property's value if object has the property, otherwise NULL.
If you named your function GetProperty, you would declare it like this:
typedef JSObjectGetPropertyNamesCallback
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:
typedef JSObjectHasInstanceCallback
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.
@result true if possibleInstance is an instance of constructor, otherwise false.
If you named your function HasInstance, you would declare it like this:
typedef JSObjectHasPropertyCallback
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.
@result true if object has the property, otherwise false.
If you named your function HasProperty, you would declare it like this:
typedef JSObjectInitializeCallback
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:
typedef JSObjectSetPropertyCallback
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.
@result true if the property was set, otherwise false.
If you named your function SetProperty, you would declare it like this: