Skip to content

API Reference / @gtkx/runtime / setObjectProperty

Function: setObjectProperty()

setObjectProperty(obj, propertyName, descriptor, jsValue): void

Defined in: packages/runtime/dist/object.d.ts:71

Writes a JavaScript value to a GObject property, converting it to native form using the descriptor. The descriptor converts what it is given rather than checking it against the property's GObject.ParamSpec, so null and undefined written to a numeric or enum property land 0, and a fractional number written to a whole-number property is truncated toward zero, where the same writes to a property installed through registerClass are refused with a TypeError.

Parameters

obj

object

The object to write to.

propertyName

string

The property name.

descriptor

Descriptor

Describes the property's type.

jsValue

unknown

The value to set.

Returns

void

Released under the MPL-2.0 License.