GitHub

ReadonlyRef

API reference for ReadonlyRef.

class ReadonlyRef[A]

A value that can be read and subscribed to.

Attributes

AttributeTypeDescription
keystr
valueA

Functions

subscribe

subscribe(f) -> Callable[[], None]

Call f with each new value; returns the unsubscribe.

ParameterTypeDescription
fCallable[[A], None]

Returns Callable[[], None]

def subscribe(self, f: Callable[[A], None]) -> Callable[[], None]:
    """Call ``f`` with each new value; returns the unsubscribe."""
    raise NotImplementedError

map

map[B](f) -> ReadonlyRef[B]

A ref of f of this one's value, notifying when it changes.

ParameterTypeDescription
fCallable[[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)