snakia.core.rx.bindable

Classes

BaseBindable([default_value])

Bindable([default_value])

A bindable value.

BindableSubscriber(*args, **kwargs)

Generic()

Abstract base class for generic types.

TypeVar(name, *constraints[, bound, ...])

Type variable.

ValueChanged(old_value, new_value)

class snakia.core.rx.bindable.Bindable(default_value=None)[source]

Bases: BaseBindable[T], Generic[T]

A bindable value.

__init__(default_value=None)[source]
property default_value: T
property has_default_value: bool
property has_value: bool
on(run_now=False)[source]

Decorator to subscribe to an value.

Return type:

Callable[[BindableSubscriber[TypeVar(T), Any]], None]

set(value)[source]

Set the value.

Return type:

None

set_silent(value)
Return type:

None

subscribe(subscriber, /, run_now=False)[source]

Subscribe to an value.

Return type:

None

property subscribers: tuple[BindableSubscriber[T, Any], ...]

Get the subscribers.

unsubscribe(subscriber)[source]

Unsubscribe from an value.

Return type:

None

property value: T