API Reference / @gtkx/react / config / ElementBehavior
Type Alias: ElementBehavior<T>
ElementBehavior<
T> =object
Defined in: reconciler/registry.d.ts:36
Customizes how one element type places children and applies props. Hooks other than create receive the GObject instance; update and flush also take the private per-node context initialize built, and attach, reorder and detach read it off their info object. Subtypes inherit a type's behaviors, except for create, which is consulted only for the type it is registered on.
Type Parameters
T
T extends GObject.Object = GObject.Object
Properties
attach?
optionalattach?: (object,child,info) =>unknown
Defined in: reconciler/registry.d.ts:42
Places a child, claiming it by returning anything other than undefined.
Parameters
object
T
child
GObject.Object
info
Returns
unknown
constructOnly?
optionalconstructOnly?:string[]
Defined in: reconciler/registry.d.ts:60
Props the behavior can only apply while the element is being built, because the library exposes no counterpart to whatever applied them. Changing one after it has been applied throws instead of silently applying the new value on top of the old.
create?
optionalcreate?: (props) =>GObject.Object
Defined in: reconciler/registry.d.ts:38
Builds the GObject from its construct props, for types whose constructor does more than set properties.
Parameters
props
Returns
GObject.Object
deferred?
optionaldeferred?:string[]
Defined in: reconciler/registry.d.ts:54
Props to withhold from the constructor, leaving them for a later hook to apply.
detach?
optionaldetach?: (object,child,info) =>void
Defined in: reconciler/registry.d.ts:46
Removes a child this behavior attached.
Parameters
object
T
child
GObject.Object
info
Returns
void
flush?
optionalflush?: (object,context) =>void
Defined in: reconciler/registry.d.ts:52
Runs after the commit that touched the node, once every child has been placed.
Parameters
object
T
context
unknown
Returns
void
initialize?
optionalinitialize?: (object) =>unknown
Defined in: reconciler/registry.d.ts:40
Builds the private per-node context the other hooks receive, once per node.
Parameters
object
T
Returns
unknown
reorder?
optionalreorder?: (object,child,info) =>unknown
Defined in: reconciler/registry.d.ts:44
Moves an already-attached child; without it, the whole slot is detached and re-attached in order.
Parameters
object
T
child
GObject.Object
info
Returns
unknown
resolve?
optionalresolve?: (object,child) =>GObject.Object|null
Defined in: reconciler/registry.d.ts:48
Returns the object the container adopts for a child, overriding whatever attach returned.
Parameters
object
T
child
GObject.Object
Returns
GObject.Object | null
update?
optionalupdate?: (object,prev,next,context) =>Iterable<string> |undefined
Defined in: reconciler/registry.d.ts:50
Applies changed props and returns the names it consumed, which are then not set as GObject properties.
Parameters
object
T
prev
next
context
unknown
Returns
Iterable<string> | undefined