/**
* Post an event to all event subscriber for the given name
* Example: MSREventBridgeModule.emitEventContext(getApplicationContext(), "eventName", data);
*/
static public void emitEventContext(Context context, final String name, @Nullable WritableMap info) {
Bundle bundle = new Bundle();
bundle.putString(EventBridgeModuleEventNameKey, name);
if (info != null) {
bundle.putBundle(EventBridgeModuleEventInfoKey, Arguments.toBundle(info));
}
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
Intent customEvent= new Intent(EventBridgeModuleIntentEventName);
customEvent.putExtra(EventBridgeModuleIntentEventDataKey, bundle);
localBroadcastManager.sendBroadcast(customEvent);
}
MSREventBridgeModule.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:react-native-event-bridge
作者:
评论列表
文章目录