reactive.patch(...): Where possible, only update the differences with the given reference value.
Reactive is the base abstraction of a reactive entity.
Its subclass ReactiveValue wraps an actual value, while ReactiveDerivative represents a derived value.
ReactiveArray is a specialization offering convenience methods to work with arrays and ReactiveObject is the same for objects.
Simple, explicit, push-based reactivity system.
Principal functionality:
Reactive.of(...)
: make a value reactive.Reactive.nest(...)
: make an object or array and their direct properties/elements reactive.Reactive.derive(tracker => reactive1.get(tracker) + reactive2.get(tracker))
: Derive a reactive value from other reactive values.reactive.get(tracker)
: Get the underlying value and track this dependency (important with derivatives ⤴️).reactive.unwrap()
: Get the underlying value without dependency tracking.reactive.consume(value => ...)
: register a consumer function that gets called with the underlying value immediately and after every update.reactive.set(...)
: Update the underlying value.reactive.patch(...)
: Where possible, only update the differences with the given reference value.Reactive is the base abstraction of a reactive entity. Its subclass ReactiveValue wraps an actual value, while ReactiveDerivative represents a derived value. ReactiveArray is a specialization offering convenience methods to work with arrays and ReactiveObject is the same for objects.
The tests contain more usage examples.