Package-level declarations

Types

Link copied to clipboard

An instance of NLifecycleOwner that is always observing (and never terminates).

Link copied to clipboard
expect interface LifecycleOwner

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

actual typealias LifecycleOwner = NLifecycleOwner

The implementation of LiveData components for iOS applications.

Link copied to clipboard
expect abstract class LiveData<T>

LiveData is an abstract class describing a data holder class that is observed within a lifetime.

actual typealias LiveData<T> = NLiveData<T>
Link copied to clipboard
actual open class LiveEvent<T> : LiveData<T>
expect open class LiveEvent<T> : LiveData<T>

LiveEventMutableLiveEvent用于透传事件,和LiveData的区别在于,LiveEvent不会触发旧值的监听

actual open class LiveEvent<T> : NLiveData<T>
Link copied to clipboard
expect open class MutableLiveData<T> : LiveData<T>

The MutableLiveData is an extension of LiveData that can have its value changed.

actual open class MutableLiveData<T> : NLiveData<T>
Link copied to clipboard
actual open class MutableLiveEvent<T> : LiveEvent<T>
expect class MutableLiveEvent<T> : LiveEvent<T>
actual open class MutableLiveEvent<T> : LiveEvent<T>
Link copied to clipboard

The NLifecycleListener is a component that listens to changes in the lifetime of a NLifecycleOwner.

Link copied to clipboard
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.

Link copied to clipboard
abstract class NLiveData<T>(_value: T?, postman: Postman<T>?)

NLiveData is an implementation of LiveData using kotlin components. It is designed to be shared between platforms that do not provide their own native solution (ie. Android).

Link copied to clipboard
interface NObserver<T>

The Observer is an interface that describes a component that is notified when a watched value is changed.

Link copied to clipboard
expect interface Observer<T>

The Observer is an interface that describes a component that is notified when a watched value is changed.

actual typealias Observer<T> = NObserver<T>
Link copied to clipboard
class OnceEvent<out T : Any>(value: T)

The OnceEvent is an object containing a value that is to be consumed once and only once.

Link copied to clipboard
interface Postman<T>

The Postman is an interface used to post a value to a LiveData object on the next event loop of the main thread.

Link copied to clipboard
class WeakEventOwner<T : Any>(val obj: <Error class: unknown class><T>) : NLifecycleOwner
Link copied to clipboard
class WeakOwner<T : Any>(val obj: <Error class: unknown class><T>) : NLifecycleOwner

Functions

Link copied to clipboard
fun <T : Any> LiveData<OnceEvent<T>>.consume(owner: LifecycleOwner, block: (T) -> Unit): Observer<OnceEvent<T>>

Consume the event as dispatched from the data object.