DynamicValue

open class DynamicValue<T>(initialValue: T)

Class represents a DynamicValue, and provides users with ability to change the value, by exposing one public method set It also allows attaching listeners (package level access), and takes care of notifying them when the held value changes.

Parameters

type of value held

Inheritors

Constructors

Link copied to clipboard
constructor(initialValue: T)

Types

Link copied to clipboard
fun interface OnValueChangeListener<T>

Interface definition for a callback to be invoked when value changes.

Properties

Link copied to clipboard

Retrieves the amount of listeners attached to this DynamicValue.

Functions

Link copied to clipboard

Register a callback to be invoked when the value changes.

Link copied to clipboard

Remove a callback.

Link copied to clipboard
fun get(): T

Retrieves the current value.

Link copied to clipboard
fun set(value: T)

Sets current value and notifies all the attached listeners