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.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page