A refreshable is a simple container for a value changing over time.
Project description
nr.refreshable
Provides the Refreshable
class. A refreshable is a thread-safe container for a value that changes
over time. Refreshables can be subscribed to, to be notified when they are updated, and mapped to
compute new values and cache them as the parent gets updated.
Example
from nr.refreshable import Refreshable
root = Refreshable(42)
child = root.map(lambda n: n + 10)
assert child.get() == 52
root.update(100)
assert child.get() == 110
Copyright © 2021 Niklas Rosenstein
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nr.refreshable-0.0.2.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for nr.refreshable-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf85b4ee7ca7b12b16159f0548e6fc1b7f6b0041c4f10572d7cd16a096e8d06 |
|
MD5 | 10375580d3c5cd4688aecd9592ebc0c9 |
|
BLAKE2b-256 | 408ac3ba359e1a00981a687a00f6dae7d5bac171e10ef47161b04724197226f6 |