JavaScriptCore.Context.register_class

### Method

# JavaScriptCore Contextregister_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` | `const char*`
| The class name.
| The data is owned by the caller of the function.
| The value is a NUL terminated UTF-8 string.
`parent_class` | `JSCClass`
| A `JSCClass` or `NULL`.
| The argument can be `NULL`.
| The data is owned by the caller of the function.
`vtable` | `JSCClassVTable`
| An optional `JSCClassVTable` or `NULL`.
| The argument can be `NULL`.
| The data is owned by the caller of the function.
`destroy_notify` | `GDestroyNotify`
| A destroy notifier for class instances.
| The argument can be `NULL`.

#### Return value

Returns: | `JSCClass`
| A `JSCClass`.
| The data is owned by the instance.