Represents a reactive binding between a GObject property and a consumer.
Bindings track a source emitter and property, and can apply transform functions to map the source value before it reaches the consumer.
const label = Widget.Label({ label: battery.bind('percent').as(p => `${p}%`),}); Copy
const label = Widget.Label({ label: battery.bind('percent').as(p => `${p}%`),});
The GObject type that emits property changes
The property key on the emitter
The transformed output type (defaults to the property type)
Alias for transform.
Transform function to apply to the bound value
A new Binding with the transform applied
Creates a new Binding with a transform function chained after any existing transforms.
const binding = service.bind('value') .transform(v => v * 2) .transform(v => `${v}px`); Copy
const binding = service.bind('value') .transform(v => v * 2) .transform(v => `${v}px`);
The transform function applied to the raw property value.
The source GObject that emits property change notifications.
The property name on the emitter being observed.
Represents a reactive binding between a GObject property and a consumer.
Bindings track a source emitter and property, and can apply transform functions to map the source value before it reaches the consumer.
Example