TerminalStateListener

abstract class TerminalStateListener<in F : Failure>(session: Session<F>) : Session.StateListener<F>

A StateListener which implements onStateChanged method. This listener will call session's methods on state changes appropriately.

Adding this listener to a session launches it if it's not already.

Consider using TerminalStateListener.bind instead of subclassing TerminalStateListener.

It's recommended to use this class with Session.addStateListener for listening to terminal state updates instead of bare StateListener, because this class handles session's lifecycle appropriately.

Constructors

Link copied to clipboard
constructor(session: Session<F>)

Types

Link copied to clipboard
class Binder<F : Failure>

Allows to add terminal state listeners to a Session.

Link copied to clipboard
object Companion
Link copied to clipboard
fun interface OnCancelListener

A listener which is invoked when a Session is cancelled.

Link copied to clipboard
fun interface OnFailureListener<in F : Failure>

A listener which is invoked when a Session completes with failure.

Link copied to clipboard
fun interface OnSuccessListener

A listener which is invoked when a Session completes successfully.

Functions

Link copied to clipboard
open fun onCancelled(sessionId: UUID)

Notifies that session was cancelled.

Link copied to clipboard
open fun onFailure(sessionId: UUID, failure: F)

Notifies that session was completed with an error.

Link copied to clipboard
override fun onStateChanged(sessionId: UUID, state: Session.State<F>)

Notifies about state update.

Link copied to clipboard
open fun onSuccess(sessionId: UUID)

Notifies that session was completed successfully.