ripe / com.ripe.android.plugins / Plugin

Plugin

open class Plugin : Observable

Base class of a Ripe Plugin.

Constructors

<init>

Plugin(options: Map<String, Any>?)

Base class of a Ripe Plugin.

Properties

options

open val options: Map<String, Any>?

A map with options to configure the plugin.

owner

var owner: Ripe?

The Ripe instance that is using this plugin.

Inherited Properties

callbacks

val callbacks: MutableMap<String, MutableList<ObservableCallback>>

A dictionary that contains all methods to be executed when an event is triggered

Functions

register

open fun register(owner: Ripe): Unit

Registers this plugin to the provided Ripe instance.

unregister

open fun unregister(): Unit

Unregisters this plugin from its owner.

Inherited Functions

addCallback

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.

bind

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 bindAsync.

bindAsync

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.

bindSync

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 bindAsync.

removeCallback

fun removeCallback(event: String, callback: ObservableCallback?): Unit

Unbinds the provided callback from an event.

runCallbacks

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.

trigger

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.

unbind

fun unbind(event: String, callback: ObservableCallback?): Unit

Unbinds the provided callback from an event.

Inheritors

SyncPlugin

class SyncPlugin : Plugin

Plugin responsible for applying synchronization rules.