Method
JavaScriptCoreClassadd_constructor
Declaration [src]
JSCValue*
jsc_class_add_constructor (
JSCClass* jsc_class,
const char* name,
GCallback callback,
gpointer user_data,
GDestroyNotify destroy_notify,
GType return_type,
guint n_params,
...
)
Description [src]
Add a constructor to jsc_class
. If name
is NULL
, the class name will be used. When jsc_value_constructor_call()
is called, callback
is invoked receiving the
parameters and user_data
as the last parameter. When the constructor object is cleared in the JSCClass
context,
destroy_notify
is called with user_data
as parameter.
This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use
jsc_context_set_value()
to make the constructor available in the global object.
Note that the value returned by callback
is adopted by jsc_class
, and the GDestroyNotify
passed to
jsc_context_register_class()
is responsible for disposing of it.
This method is not directly available to language bindings. |
The implementation of this method is provided by jsc_class_add_constructorv() in language bindings |
Parameters
name |
const char* |
The constructor name or |
|
The argument can be NULL . | |
The data is owned by the caller of the function. | |
The value is a NUL terminated UTF-8 string. | |
callback |
GCallback |
A |
|
user_data |
gpointer |
User data to pass to |
|
The argument can be NULL . | |
The data is owned by the caller of the function. | |
destroy_notify |
GDestroyNotify |
Destroy notifier for |
|
The argument can be NULL . | |
return_type |
GType |
The |
|
n_params |
guint |
The number of parameter types to follow or 0 if constructor doesn’t receive parameters. |
|
... |
|
A list of |
Return value
Returns: | JSCValue |
A |
|
The caller of the method takes ownership of the data, and is responsible for freeing it. |