Joo*_*oon 10 event-handling react-native
有removeCurrentListener,但没有removeListener方法.
Joo*_*oon 30
我自己找到了答案.
addListener返回EmitterSubscription扩展EventSubscription具有remove方法的实例.
const emitter = new EventEmitter();
const subscription = emitter.addListener('eventname', () => {});
subscription.remove(); // Removes the subscription
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9886 次 |
| 最近记录: |