onWillDetach

fun onWillDetach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken

Registers listener for the WillDetach event.

NOTE: Listener is not called if this instance is already detached.

Parameters

validity

Specify how many events should the listener receive. Defaults to an infinite validity.