2018-11-19 11:25:28 +01:00
|
|
|
package com.reactnativecommunity.webview.events
|
|
|
|
|
|
|
|
|
|
import com.facebook.react.bridge.Arguments
|
|
|
|
|
import com.facebook.react.uimanager.events.Event
|
|
|
|
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event emitted when there is an error in loading.
|
|
|
|
|
*/
|
|
|
|
|
class TopMessageEvent(viewId: Int, private val mData: String) : Event<TopMessageEvent>(viewId) {
|
2019-03-19 15:42:47 +01:00
|
|
|
companion object {
|
|
|
|
|
const val EVENT_NAME = "topMessage"
|
|
|
|
|
}
|
2018-11-19 11:25:28 +01:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun getEventName(): String = EVENT_NAME
|
2018-11-19 11:25:28 +01:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun canCoalesce(): Boolean = false
|
2018-11-19 11:25:28 +01:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun getCoalescingKey(): Short = 0
|
2018-11-19 11:25:28 +01:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun dispatch(rctEventEmitter: RCTEventEmitter) {
|
|
|
|
|
val data = Arguments.createMap()
|
|
|
|
|
data.putString("data", mData)
|
|
|
|
|
rctEventEmitter.receiveEvent(viewTag, EVENT_NAME, data)
|
|
|
|
|
}
|
2018-11-19 11:25:28 +01:00
|
|
|
}
|