open class Interactable : Observable
An entity that reactively represents a Ripe instance.
Interactable(owner: Ripe, options: Map<String, Any>?)
An entity that reactively represents a Ripe instance. |
open val options: Map<String, Any>?
A map with options to configure the instance. |
|
open val owner: Ripe
The ripe instance that will be represented. |
val callbacks: MutableMap<String, MutableList<ObservableCallback>>
A dictionary that contains all methods to be executed when an event is triggered |
open fun deinit(): Unit
This method is called by the owner when it is deinitializing so that any necessary cleanup operations can be executed. |
|
open fun update(state: Map<String, Any>): Unit
This method is called by the owner whenever its state changes so that the instance can update itself for the new state. |
fun addCallback(event: String, callback: ObservableCallback): ObservableCallback
Binds to an event by providing a block that will receive the event payload as a parameter and return a Deferred that will be completed asynchronously. |
|
fun bind(event: String, callback: (args: Map<String, Any>) -> Unit): ObservableCallback
Binds to an event by providing a block that will receive the event payload as a
parameter. The block will be executed synchronously, for costly operations prefer
the use of |
|
fun bindAsync(event: String, callback: ObservableCallback): ObservableCallback
Binds to an event by providing a block that will receive the event payload as a parameter and return a Deferred that will be completed asynchronously. |
|
fun bindSync(event: String, callback: (args: Map<String, Any>) -> Unit): ObservableCallback
Binds to an event by providing a block that will receive the event payload as a
parameter. The block will be executed synchronously, for costly operations prefer
the use of |
|
fun removeCallback(event: String, callback: ObservableCallback?): Unit
Unbinds the provided callback from an event. |
|
fun runCallbacks(event: String, args: Map<String, Any> = HashMap()): Deferred<List<Any?>>
Triggers the event by calling all its bound callbacks with args as parameters. |
|
fun trigger(event: String, args: Map<String, Any> = HashMap()): Deferred<List<Any?>>
Triggers the event by calling all its bound callbacks with args as parameters. |
|
fun unbind(event: String, callback: ObservableCallback?): Unit
Unbinds the provided callback from an event. |
open class Visual : Interactable
This is a superclass for visual representations of a Ripe instance. |