Skip to main content

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


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)

Uploaded source

Built Distribution

nr.refreshable-0.0.2-py3-none-any.whl (3.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page