Callbacker

open class Callbacker<T>

Organize multiple callbacks for a function that accepts a single parameter

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun add(fn: (T) -> Unit): Int

adds a callback into this object. The returned key is used to remove or replace the callback

fun add(key: Int, fn: (T) -> Unit): Int

adds a callback into this object by key. If a callback of this key exists, it will be replaced.

Link copied to clipboard
fun invoke(param: T)

call every callback with the provided parameter

Link copied to clipboard
fun remove(key: Int): Int