subscribe

open fun subscribe(onStateChange: (State) -> Unit): Disposable

Invokes onStateChange on each change of currentState. Returns a Disposable that should be disposed when subscription is no longer needed. Initial value is delivered with onStateChange before this method returns.


open fun <Selected> subscribe(selector: <Error class: unknown class><State, Selected>, onStateChange: (Selected) -> Unit): Disposable

Invokes onStateChange on each change of selected state with selector. Returns a Disposable that should be disposed when subscription is no longer needed. Initial value is delivered with onStateChange before this method returns.