Class
JavaScriptCoreClass
Description [src]
final class JavaScriptCore.Class : GObject.Object {
parent: GObject,
priv: JSCClassPrivate*
}
A JSSClass represents a custom JavaScript class registered by the user in a JSCContext
.
It allows to create new JavaScripts objects whose instances are created by the user using
this API.
It’s possible to add constructors, properties and methods for a JSSClass by providing
GCallback
s to implement them.
Instance methods
jsc_class_add_constructor
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.
jsc_class_add_constructor_variadic
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
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.
jsc_class_add_constructorv
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.
jsc_class_add_method
Add method with name
to jsc_class
. When the method is called by JavaScript or jsc_value_object_invoke_method(),
callback
is called receiving the class instance as first parameter, followed by the method parameters and then
user_data
as last parameter. When the method is cleared in the JSCClass
context, destroy_notify
is called with
user_data
as parameter.
jsc_class_add_method_variadic
Add method with name
to jsc_class
. When the method is called by JavaScript or jsc_value_object_invoke_method(),
callback
is called receiving the class instance as first parameter, followed by a GPtrArray
of JSCValue
s
with the method arguments and then user_data
as last parameter. When the method is cleared in the JSCClass
context,
destroy_notify
is called with user_data
as parameter.
jsc_class_add_methodv
Add method with name
to jsc_class
. When the method is called by JavaScript or jsc_value_object_invoke_method(),
callback
is called receiving the class instance as first parameter, followed by the method parameters and then
user_data
as last parameter. When the method is cleared in the JSCClass
context, destroy_notify
is called with
user_data
as parameter.
jsc_class_add_property
Add a property with name
to jsc_class
. When the property value needs to be getted, getter
is called
receiving the the class instance as first parameter and user_data
as last parameter. When the property
value needs to be set, setter
is called receiving the the class instance as first parameter, followed
by the value to be set and then user_data
as the last parameter. When the property is cleared in the
JSCClass
context, destroy_notify
is called with user_data
as parameter.
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.