Documentation / dataflow / com.femastudios.dataflow.listen
Go to reference

Package com.femastudios.dataflow.listen

Package that contains all the classes and interfaces related to listening to Field changes.

Types

BaseLifecycleOwner

A basic implementation of LifecycleOwner. It is usually sufficient to use the lifecycle function instead.

open class BaseLifecycleOwner : MapLifecycleOwner

FieldListener

The callback called when a Field changes.

interface FieldListener<in T>

LifecycleOwner

An object that implements LifecycleOwner can easily listen for Field changes, by calling listen.

interface LifecycleOwner

ListenerHolder

An object that is responsible to manage the listening of a Field.

sealed class ListenerHolder<out T>

MapLifecycleOwner

An implementation of LifecycleOwner that uses a Map to hold the ListenerHolder

interface MapLifecycleOwner : LifecycleOwner

Extensions for External Classes

com.femastudios.listeners.ListenersManager

Properties

globalLifecycle

Returns a global LifecycleOwner. Listener are never unregistered automatically.

val globalLifecycle: LifecycleOwner

Functions

fieldListener

Utility method to create a new FieldListener from a lambda

fun <T> fieldListener(listener: (source: Field<T>, newData: T) -> Unit): FieldListener<T>

lifecycle

Calls the specified function f with a new LifecycleOwner as its receiver and returns its result.

fun <T> lifecycle(f: LifecycleOwner.() -> T): T

simpleFieldListener

Utility method to create a new FieldListener from a lambda

fun <T> simpleFieldListener(listener: (newData: T) -> Unit): FieldListener<T>