2019-03-13 18:21:25 +03:00
|
|
|
package com.reactnativecommunity.webview.events
|
|
|
|
|
|
|
|
|
|
import com.facebook.react.bridge.WritableMap
|
|
|
|
|
import com.facebook.react.uimanager.events.Event
|
|
|
|
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event emitted when shouldOverrideUrlLoading is called
|
|
|
|
|
*/
|
|
|
|
|
class TopShouldStartLoadWithRequestEvent(viewId: Int, private val mData: WritableMap) : Event<TopShouldStartLoadWithRequestEvent>(viewId) {
|
2019-03-19 15:42:47 +01:00
|
|
|
companion object {
|
|
|
|
|
const val EVENT_NAME = "topShouldStartLoadWithRequest"
|
|
|
|
|
}
|
2019-03-13 18:21:25 +03:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
init {
|
|
|
|
|
mData.putString("navigationType", "other")
|
|
|
|
|
}
|
2019-03-13 18:21:25 +03:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun getEventName(): String = EVENT_NAME
|
2019-03-13 18:21:25 +03:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun canCoalesce(): Boolean = false
|
2019-03-13 18:21:25 +03:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun getCoalescingKey(): Short = 0
|
2019-03-13 18:21:25 +03:00
|
|
|
|
2019-03-19 15:42:47 +01:00
|
|
|
override fun dispatch(rctEventEmitter: RCTEventEmitter) =
|
|
|
|
|
rctEventEmitter.receiveEvent(viewTag, EVENT_NAME, mData)
|
2019-03-13 18:21:25 +03:00
|
|
|
}
|