### Method

# JavaScriptCore Context register_class

#### Declaration [src]

    JSCClass*
    jsc_context_register_class (
      JSCContext* context,
      const char* name,
      JSCClass* parent_class,
      JSCClassVTable* vtable,
      GDestroyNotify destroy_notify
    )

#### Description [src]

Register a custom class in `context` using the given `name`. If the new class inherits from another `JSCClass`, the parent should be passed as `parent_class`, otherwise `NULL` should be used. The optional `vtable` parameter allows to provide a custom implementation for handling the class, for example, to handle external properties not added to the prototype. When an instance of the `JSCClass` is cleared in the context, `destroy_notify` is called with the instance as parameter.

#### Parameters

`name`

  Type: `const char*`

  The class name.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`parent_class`

  Type: `JSCClass`

  A `JSCClass` or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`vtable`

  Type: `JSCClassVTable`

  An optional `JSCClassVTable` or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`destroy_notify`

  Type: `GDestroyNotify`

  A destroy notifier for class instances.

  The argument can be `NULL`.

#### Return value

Type: `JSCClass`

A `JSCClass`.

The data is owned by the instance.