class AtomRef[A]
A ref that can be set.
Functions#
set#
set(value) -> Self| Parameter | Type | Description |
|---|---|---|
value | A |
Returns Self
def set(self, value: A) -> Self:
raise NotImplementedErrorupdate#
update(f) -> Self| Parameter | Type | Description |
|---|---|---|
f | Callable[[A], A] |
Returns Self
def update(self, f: Callable[[A], A]) -> Self:
return self.set(f(self.value))prop#
prop(key) -> AtomRef[Any]A ref of one field of this ref's value; setting it sets this ref to a copy with that field replaced.
| Parameter | Type | Description |
|---|---|---|
key | Any |
Returns AtomRef[Any]
def prop(self, key: Any) -> AtomRef[Any]:
"""A ref of one field of this ref's value; setting it sets this
ref to a copy with that field replaced."""
return _PropRef(self, key)subscribe#
subscribe(f) -> Callable[[], None]Call f with each new value; returns the unsubscribe.
| Parameter | Type | Description |
|---|---|---|
f | Callable[[A], None] |
Returns Callable[[], None]
def subscribe(self, f: Callable[[A], None]) -> Callable[[], None]:
"""Call ``f`` with each new value; returns the unsubscribe."""
raise NotImplementedErrormap#
map[B](f) -> ReadonlyRef[B]A ref of f of this one's value, notifying when it changes.
| Parameter | Type | Description |
|---|---|---|
f | Callable[[A], B] |
Returns ReadonlyRef[B]
def map[B](self, f: Callable[[A], B]) -> ReadonlyRef[B]:
"""A ref of ``f`` of this one's value, notifying when it changes."""
return _MapRef(self, f)