addConstructorVariadic

fun addConstructorVariadic(name: String? = null, callback: <Error class: unknown class>, returnType: <Error class: unknown class>): Value

Add a constructor to @jsc_class. If @name is null, the class name will be used. When new is used with the constructor or jsc_value_constructor_call() is called, @callback is invoked receiving a #GPtrArray of #JSCValues 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.

Return

a #JSCValue representing the class constructor.

Parameters

name

the constructor name or null

callback

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

returnType

the #GType of the constructor return value