Java Code Examples for com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter#emit()

The following examples show how to use com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter#emit() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onDataSend(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  long progress,
  long total) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushInt((int) progress);
  args.pushInt((int) total);
  eventEmitter.emit("didSendNetworkData", args);
}
 
Example 2
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onIncrementalDataReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  String data,
  long progress,
  long total) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(data);
  args.pushInt((int) progress);
  args.pushInt((int) total);

  eventEmitter.emit("didReceiveNetworkIncrementalData", args);
}
 
Example 3
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onDataReceivedProgress(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  long progress,
  long total) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushInt((int) progress);
  args.pushInt((int) total);

  eventEmitter.emit("didReceiveNetworkDataProgress", args);
}
 
Example 4
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onDataReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  String data) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(data);

  eventEmitter.emit("didReceiveNetworkData", args);
}
 
Example 5
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onDataReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  WritableMap data) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushMap(data);

  eventEmitter.emit("didReceiveNetworkData", args);
}
 
Example 6
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onRequestError(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  String error,
  IOException e) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(error);

  if ((e != null) && (e.getClass() == SocketTimeoutException.class)) {
    args.pushBoolean(true); // last argument is a time out boolean
  }

  eventEmitter.emit("didCompleteNetworkResponse", args);
}
 
Example 7
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onRequestSuccess(RCTDeviceEventEmitter eventEmitter, int requestId) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushNull();

  eventEmitter.emit("didCompleteNetworkResponse", args);
}
 
Example 8
Source Project: react-native-GPay   File: ResponseUtil.java    License: MIT License 5 votes vote down vote up
public static void onResponseReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  int statusCode,
  WritableMap headers,
  String url) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushInt(statusCode);
  args.pushMap(headers);
  args.pushString(url);

  eventEmitter.emit("didReceiveNetworkResponse", args);
}