onDispose

open fun onDispose(action: suspend () -> Unit): RemoveContextCallback

Creates a new dispose callback that is invoked when the context is being destroyed.

Return

a lambda that can be invoked to remove the callback