Stream

Stream

interface Stream

A simple representation of an observable stream. Subscription will requires a key to avoid multiple subscription of the same observable.

Methods

onNext

abstract fun onNext(data1: T?)

Post data to the stream

Parameters

Name Description
data1: T?

ReturnValue

Name Description
Unit

subscribe

abstract fun subscribe(key: Any, observer: (T?)->Unit)

Add an observable to receive future values of the stream

Parameters

Name Description
key: Any
observer: (T?)->Unit

ReturnValue

Name Description
Unit

unsubscribe

abstract fun unsubscribe(key: Any)

Stop the observable at from receiving events

Parameters

Name Description
key: Any

ReturnValue

Name Description
Unit

clear

abstract fun clear()

Remove all the observable from this stream

ReturnValue

Name Description
Unit

latest

abstract fun latest(): T?

Get the latest value of the stream

ReturnValue

Name Description
T?