mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-08-31 11:41:08 +00:00
41 lines
1.1 KiB
Java
41 lines
1.1 KiB
Java
package com.reactnativecommunity.webview.events;
|
|||
|
|
|
||
|
|
import com.facebook.react.bridge.Arguments;
|
||
|
|
import com.facebook.react.bridge.WritableMap;
|
||
|
|
import com.facebook.react.uimanager.events.Event;
|
||
|
|
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||
|
|
|
||
|
|
public class TopShouldStartLoadWithRequestEvent extends Event<TopMessageEvent> {
|
||
|
|
public static final String EVENT_NAME = "topShouldStartLoadWithRequest";
|
||
|
|
private final String mUrl;
|
||
|
|
|
||
|
|
public TopShouldStartLoadWithRequestEvent(int viewId, String url) {
|
||
|
|
super(viewId);
|
||
|
|
mUrl = url;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public String getEventName() {
|
||
|
|
return EVENT_NAME;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public boolean canCoalesce() {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public short getCoalescingKey() {
|
||
|
|
// All events for a given view can be coalesced.
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void dispatch(RCTEventEmitter rctEventEmitter) {
|
||
|
|
WritableMap data = Arguments.createMap();
|
||
|
|
data.putString("url", mUrl);
|
||
|
|
data.putString("navigationType", "other");
|
||
|
|
rctEventEmitter.receiveEvent(getViewTag(), EVENT_NAME, data);
|
||
|
|
}
|
||
|
|
}
|