GuiMutableList

Does the same as GuiList, but is mutatable. If you change the content if this list using the mutate function, the gui will update accordingly.

See also

Constructors

Link copied to clipboard
constructor(collection: MutableList<T>)

Functions

Link copied to clipboard
fun invokeListeners(): Job

Invokes all listeners, causing all open guis using this list to update.

Link copied to clipboard
inline suspend fun <R> lookup(block: (List<T>) -> R): R

Provides access to the internal collection in an immutable form. Please do only use the collection inside the block lambda, as only there thread-safety can be guaranteed.

Link copied to clipboard
inline suspend fun mutate(crossinline block: suspend (MutableList<T>) -> Unit): Job

Inside the given block, you can mutate this list. All guis currently using this list will be informed after that mutation, to update properly.

Link copied to clipboard
fun onChange(block: suspend (List<T>) -> Unit)

Registers an onChangeListener, which will be called if the content of this list is mutated.

Link copied to clipboard
fun removeOnChangeListener(block: suspend (List<T>) -> Unit)

Unregisters an already registered onChangeListener.