mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-29 06:06:52 +08:00
19 lines
532 B
Markdown
Executable File
19 lines
532 B
Markdown
Executable File
# 终端事件
|
|
|
|
当终端网络切换,或者横竖屏改变的时候,终端需要向前端发送一些全局的广播事件,这样前端可以根据不同的状态来控制业务状态。
|
|
|
|
---
|
|
|
|
# 终端发送
|
|
|
|
终端在需要发送事件的地方调用代码:
|
|
|
|
```java
|
|
HippyMap hippyMap = new HippyMap();
|
|
hippyMap.pushString("result", "hello i am from native");
|
|
mEngineManager.getCurrentEngineContext()
|
|
.getModuleManager()
|
|
.getJavaScriptModule(EventDispatcher.class)
|
|
.receiveNativeEvent("rotate", hippyMap);
|
|
```
|