Skip to content

API Reference / @gtkx/runtime / coerceObjectProperty

Function: coerceObjectProperty() ​

coerceObjectProperty(obj, propertyName, value): unknown

Defined in: packages/runtime/src/properties.ts:473

Coerces a finite number to a native property's accepted range. Integer, enum, and flag values are truncated toward zero, then clamped to the GObject.ParamSpec range.

Non-finite and nonnumeric values, values the property cannot hold, and values for unknown properties are returned unchanged.

Parameters ​

obj ​

object

Object whose property will be written.

propertyName ​

string

Dashed or camelCased property name.

value ​

unknown

Value to coerce.

Returns ​

unknown

The coerced value, or the original value when coercion does not apply.