Class.addConstructorVariadic

Add a constructor to @jsc_class. If @name is %NULL, the class name will be used. When <function>new</function> is used with the constructor or jsc_value_constructor_call() is called, @callback is invoked receiving a #GPtrArray of #JSCValue<!-- -->s as arguments 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.

class Class
addConstructorVariadic
(
string name
,
GCallback callback
,
void* userData
,
GDestroyNotify destroyNotify
,)

Parameters

name string

the constructor name or %NULL

callback GCallback

a #GCallback to be called to create an instance of @jsc_class

userData void*

user data to pass to @callback

destroyNotify GDestroyNotify

destroy notifier for @user_data

returnType GType

the #GType of the constructor return value

Return Value

Type: Value

a #JSCValue representing the class constructor.

Meta