Event Bridge
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
web View
The WebView to which the event bridge will add the connection Javascript interface.
event Bus
The event bus to which events are posted.
json
The serializer instance.
connection Key
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")