Observer
Creates a mutable ref object. You can access the .current
value and detect the value change through .subscribe
.
class Observer<Value = any>
See
Properties
return the current value.
Methods
When the current value changes, the callback function is called.
Cancel the registered subscription through callback.
Constructor
new Observer<Value>(value: Value): Observer<Value>
Parameters
value
Value
Properties
current
currentValue
return the current value.
Methods
subscribe
subscribeObserver<Value>
subscribe(callback: ((value: Value, prevValue: Value) => void)): Observer<Value>
When the current value changes, the callback function is called.
Parameters
callback
((value: Value, prevValue: Value) => void)