The type of the atom's value.
Constructs a new BaseAtom, setting the initial value and initializing the subscriber list to an empty array.
The initial value of the BaseAtom.
The list of active subscribers listening or value changes on this atom. Subscribers are called anytime the value is updated.
The value of the atom, BaseAtom does not provide any means for updating this after the object is created.
This readonly property will return the current active value of the atom.
The current value of the atom.
An internal test that determines if any subscribers are currently subscribed to this atom's value changes.
A boolean representing if there are any subscribers currently subscribed to this atom.
An internal helper that will fire all the subscribers passing this
to
them, this is typically only triggered in response to value changes.
An internal helper that will update the value of the atom. Note that it's protected, there is no public way to modify a BaseAtom's value this is for subclasses to used.
The new value for the atom's value field.
Subscribe to the atom's value updates with the given subscriber. This subscriber will be called with the instance of the atom anytime it's value changes (of course the BaseAtom does not have a public mechanism for the value to change).
The subscriber to add to the list of subscribers listening for value changes.
Unsubscribe the given subscriber from value updates on this atom. If the
subscriber is in the list of subscribers it will be removed, and if it's
no already a subscriber then nothing will happen. If null
is passed
instead of a subscriber then all subscribers will be removed.
The subscriber to remove or null to remove all subscribers.
Generated using TypeDoc
BaseAtom provides the basic functionality for atoms such as the readonly value property and handling subscribers. These are the basic requirements required to meet the IAtom interface.
DO NOT INSTANTIATE This is the abstract base class for all atom-like objects. Either extend it to create your own atom-like objects or use one of the factory functions to create a usable instance of an atom based on your needs.