EventBridge

open class EventBridge(val webView: WebView, val eventBus: EventBus = EventBus.getDefault(), val json: Json = Json { encodeDefaults = true ignoreUnknownKeys = true serializersModule = SerializersModule { contextual(FileSerializer) contextual(IntentSerializer) contextual(ThrowableSerializer) contextual(UriSerializer) contextual(AnySerializer()) } }, val connectionKey: String = "racehorseConnection")

The event bridge enables communication between the app in the WebView and Android-native code.

Parameters

webView

The WebView to which the event bridge will add the connection Javascript interface.

eventBus

The event bus to which events are posted.

json

The serializer instance.

connectionKey

The key of the window that exposes the connection Javascript interface.

Constructors

Link copied to clipboard
constructor(webView: WebView, eventBus: EventBus = EventBus.getDefault(), json: Json = Json { encodeDefaults = true ignoreUnknownKeys = true serializersModule = SerializersModule { contextual(FileSerializer) contextual(IntentSerializer) contextual(ThrowableSerializer) contextual(UriSerializer) contextual(AnySerializer()) } }, connectionKey: String = "racehorseConnection")

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val eventBus: EventBus
Link copied to clipboard
val json: Json
Link copied to clipboard

Functions

Link copied to clipboard
open fun disable()
Link copied to clipboard
open fun enable()
Link copied to clipboard
@Subscribe
open fun onIsSupported(event: IsSupportedEvent)
Link copied to clipboard
@Subscribe
open fun onNoSubscriber(event: NoSubscriberEvent)
Link copied to clipboard
@Subscribe
open fun onNotice(event: NoticeEvent)
Link copied to clipboard
@Subscribe
open fun onResponse(event: ResponseEvent)
Link copied to clipboard
@Subscribe
open fun onSubscriberException(event: SubscriberExceptionEvent)
Link copied to clipboard
open fun post(eventJson: String): String