API Reference / @gtkx/runtime / registerClass
Function: registerClass()
registerClass<
T,TProperties,TSignals,TInterfaces>(klass,options?):RegisteredClass<T,TProperties,TSignals,TInterfaces>
Defined in: packages/runtime/src/register-class.ts:448
Registers a wrapper subclass as a GType with discovered vfuncs, properties, signals, and interfaces. Vfuncs must be prototype methods; function-valued fields never reach the vtable. A matching on<SignalName> method becomes the signal's default handler.
vfuncConstructed runs before field initializers and the constructor body. Native-created instances never run the JavaScript constructor, so native-required state belongs in properties or vfuncConstructed. A new Gio.AsyncInitable must implement vfuncInitAsync.
Type Parameters
T
T extends AnyClass
TProperties
TProperties extends Record<string, object> = Record<never, object>
TSignals
TSignals extends Record<string, SignalSpec> = Record<never, SignalSpec>
TInterfaces
TInterfaces extends readonly Interface<T["prototype"], object>[] = readonly Interface<T["prototype"], object>[]
Parameters
klass
T
The wrapper subclass to register.
options?
RegisterClassOptions<T["prototype"], TProperties, TSignals, TInterfaces>
Additional GType configuration.
Returns
RegisteredClass<T, TProperties, TSignals, TInterfaces>
The registered class with declared properties and signals in its type.
Throws
For invalid parents, names, interfaces, vfuncs, properties, signals, or widget options. A classInit exception propagates after the static type has been registered and cannot be undone.