DataObserver

abstract class DataObserver<T> : LifecycleObserver

Public facing interface for users to grab data

Constructors

DataObserver
Link copied to clipboard
fun DataObserver()

Types

Thread
Link copied to clipboard
enum Thread : Enum<DataObserver.Thread>
Represents a thread in which the result of a subscribe should be handled on.

Functions

dispose
Link copied to clipboard
fun dispose()
This will dispose any api calls being made from this observer
isDisposed
Link copied to clipboard
fun isDisposed(): Boolean
subscribe
Link copied to clipboard
fun subscribe(onSuccess: (T) -> Unit, onError: (Throwable) -> Unit = {}, thread: DataObserver.Thread = Thread.Main): DataObserver<T>
This will allow users to subscribe for data

Properties

onDisposed
Link copied to clipboard
var onDisposed: () -> Unit? = null
An optional callback that will be triggered after the DataObserver has been disposed.

Extensions

convertToRxJava
Link copied to clipboard
fun <T> DataObserver<T>.convertToRxJava(): Single<T>
Converts a DataObserver back into an RxJava pipeline, as a Single.
getNow
Link copied to clipboard
fun <T> DataObserver<T>.getNow(): Pair<T?, Throwable?>
Provides blockingGet() functionality to DataObservers.