Class

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.

Constructors

this
this(JSCClass* jSCClass, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Functions

addConstructorVariadic
Value addConstructorVariadic(string name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType)

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.

addConstructorv
Value addConstructorv(string name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, GType[] parameterTypes)

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 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.

addMethodVariadic
void addMethodVariadic(string name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType)

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.

addMethodv
void addMethodv(string name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, GType[] parameterTypes)

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.

addProperty
void addProperty(string name, GType propertyType, GCallback getter, GCallback setter, void* userData, GDestroyNotify destroyNotify)

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.

getClassStruct
JSCClass* getClassStruct(bool transferOwnership)

Get the main Gtk struct

getName
string getName()

Get the class name of @jsc_class

getParent
Class getParent()

Get the parent class of @jsc_class

getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

getType
GType getType()

Variables

jSCClass
JSCClass* jSCClass;

the main Gtk struct

Meta