Skip to content

API Reference / @gtkx/react / config / defineBehavior

Variable: defineBehavior ​

const defineBehavior: <T>(hooks) => ElementBehavior<never>

Defined in: reconciler/registry.d.ts:119

Types one behavior against the GObject class it applies to, so every hook's object parameter is inferred rather than annotated by hand. Pass the class as the type argument.

ts
defineElements({
    GtkFrame: { behaviors: [defineBehavior<Gtk.Frame>({ attach: (frame, child) => frame.setChild(child) })] },
});

Type Parameters ​

T ​

T extends GObject.Object

Parameters ​

hooks ​

ElementBehavior<T>

Returns ​

ElementBehavior<never>

Released under the MPL-2.0 License.