subscription

fun subscription(onDispose: () -> Unit? = null): Disposable

Creates a Disposable which calls the given onDispose function when the subscription is disposed.

The returned implementation is not considered to be thread-safe, so interaction is expected to be constrained to an appropriate thread by the user.

Return

A Disposable to use to dispose of the subscription

Parameters

onDispose

Optional callback to execute when this Disposable is disposed.