API Reference / @gtkx/runtime / coerceObjectProperty
Function: coerceObjectProperty()
coerceObjectProperty(
obj,propertyName,value):unknown
Defined in: packages/runtime/dist/properties.d.ts:67
Fits a number to what a GObject property accepts, the way an animation writing a value on every frame needs: a fractional number headed for a property that holds whole numbers, such as a gint, an enum, or flags, is truncated toward zero, and a number outside the range the property's GObject.ParamSpec allows is clamped to it, so the write that follows never trips GObject's range check. Anything that is not a finite number, a number the property cannot hold at all, and a name the object installs no property under come back unchanged.
Parameters
obj
object
The object the value is about to be written to.
propertyName
string
The property name, dashed or camelCased.
value
unknown
The value about to be written.
Returns
unknown
The value as the property accepts it.