A flag to control the replay behaviour of a Unit. It decides whether the value should be replayed when you subscribe to the default Observable.
A unique id to identify a Unit. It's required for a Unit to be persistent.
Optional config option to set the cache size.
It can be minimum 1
, and maximum Infinity
.
Otherwise, if it's not provided, or it's not valid, the default cache size 2
will be used.
An optional custom check function, if provided, can allow or disallow values from getting through dispatch.
Set it to true
to debounce the dispatch method.
If set it to true
the default wait-time is 200ms,
otherwise you can pass a number
as wait-time, which is in ms.
If the dispatchDebounce is enabled, the debounce mode determines on which edge of the wait-time, the call passes through.
In a debounce wait-time span,
START means only the first call to dispatch gets through.
END means only the last call to dispatch gets through.
BOTH means both, the first and last dispatch calls get through.
The default is END
.
An optional flag to disable/enable the distinct value check on the dispatched values.
An optional flag to make the Unit's value immutable.
The initial value for the Unit to be used instead of the default value.
Type T is the type of the Unit's value. i.e. boolean for BoolUnit.
If an initialValue
is not provided or if its invalid, it'll be ignored,
and the default value of the Unit will be used instead.
An optional flag to make the Unit persistent, using LocalStorage or SessionStorage. An id (see BaseConfig.id) is mandatory to make it work.
The Storage to be used for storing the value if the Unit is persistent.
It can be either LocalStorage
or SessionStorage
or any other API,
that implements Storage
API interface.
Configuration options for all the Units.