JavaScriptCore.Class
Description: Reference for JavaScriptCore.Class

### Class

# JavaScriptCoreClass

unstable since: 4.1

#### Description [src]

    final class JavaScriptCore.Class : GObject.Object
    {
      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.

Available since: 4.1

#### Ancestors

- GObject

#### Instance methods

###### jsc_class_add_constructor

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

unstable since: 4.1

###### jsc_class_add_constructor_variadic

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

unstable since: 4.1

###### jsc_class_add_constructorv

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

unstable since: 4.1

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

unstable since: 4.1

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

unstable since: 4.1

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

unstable since: 4.1

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

unstable since: 4.1

###### jsc_class_get_name

Get the class name of `jsc_class`.

unstable since: 4.1

###### jsc_class_get_parent

Get the parent class of `jsc_class`.

unstable since: 4.1

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### JavaScriptCore.Class:context

The `JSCContext` in which the class was registered.

unstable since: 4.1

###### JavaScriptCore.Class:name

The name of the class.

unstable since: 4.1

###### JavaScriptCore.Class:parent

The parent class or `NULL` in case of final classes.

unstable since: 4.1

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

since: 2.0

#### Class structure

    struct JavaScriptCoreClassClass {
      /* no available fields */
    }

No description available.