boolean
, string
or array
. array
like data structure which is also an Observable and implements all the Array.prototype
methods in a way that, any mutation caused by these methods, emits a new array
with the mutations applied to it.value()
method.NumUnit
has 0
as the default value, and StringUnit
has ''
. That's why in the above example the unit1
and unit2
are equivalent.unit1
, a value immediately gets logged to the console even though we haven't dispatched any value yet. If you are only interested in future values you can use future$
Observable, which doesn't replay the last value on subscription, it only emits future values.dispatch
method, the dispatch
method returns true
or false
depending on the success of dispatch, which you can use to make any further decisions.goBack
method and for redo we can use goForward
method respectively.number
which is already immutable.localStorage
, and a configuration flag.localStorage
.replay
method.Unit.value()
Number.prototype
methods to make it easier to work with the stored value. Similarly, ListUnit implements all the Array.prototype
methods, StringUnit implements all the String.prototype
methods, and so on.get
and set
methods instead. And the fact that BoolUnit, NumUnit or StringUnit aren't actually primitives, the typeof
operator will only return object
.