API Reference / @gtkx/runtime / newObjectWithProperties
Function: newObjectWithProperties()
newObjectWithProperties<
T>(gtype,props,wrapper):T
Defined in: packages/runtime/src/object.ts:153
Constructs a GObject with the supplied properties and binds its JavaScript wrapper.
Type Parameters
T
T extends object
Parameters
gtype
bigint
GType to construct.
props
object
Construct property names and values.
wrapper
T
Wrapper to bind unless the object already has one.
Returns
T
The supplied wrapper or the object's existing wrapper.
Remarks
Properties declared through registerConstructProperties use their descriptors. Other properties use the type's GObject.ParamSpec, accepting dashed or camelCased names. Unknown properties and undefined values are skipped.
For types created with registerClass, the wrapper is bound before constructed runs. If construction has already exposed the object to JavaScript, its existing wrapper is reused instead, preserving identity.
Throws
When a ParamSpec-backed property is read-only or cannot hold the value's type.
Throws
When a ParamSpec rejects the value.