NLifecycleOwner

interface NLifecycleOwner

The NLifecycleOwner is an interface that describes a component with an lifetime that makes observations for a period of time and and is eventually terminated.

A view is an example of a component with such a lifetime whereby:

  1. The view is created.

  2. The view vacillates between observing and not observing.

  3. The view is terminated.

Lifetime components adhere to the following flow:

| observing | <---> | not observing |

|                       |
-------------------------
            |
            v
      --------------
      | terminated |
      --------------

Inheritors

Functions

Link copied to clipboard
abstract fun addListener(listener: NLifecycleListener)

Listen the changing state of the lifetime.

Link copied to clipboard
abstract fun isObserving(): Boolean

Get whether or not the observer should currently be observing.

Link copied to clipboard
abstract fun isTerminated(): Boolean

Get whether or not the observer has been terminated (and will never observe again).

Link copied to clipboard
abstract fun removeListener(listener: NLifecycleListener)

Remove the listener from the lifetime.