Skip to content

Commit 60b2620

Browse files
authored
Merge pull request #315 from zxcpoiu/fix_initial_listener
fix: not to add `didLoadWithEvents` in constructor
2 parents 523f683 + 001c79b commit 60b2620

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,11 @@ Called as soon as JS context initializes if there were some actions performed by
608608
Since iOS 13, you must display incoming call on receiving PushKit push notification. But if app was killed, it takes some time to create JS context. If user answers the call (or ends it) before JS context has been initialized, user actions will be passed as events array of this event. Similar situation can happen if user would like to start a call from Recents or similar iOS app, assuming that your app was in killed state.
609609

610610
```js
611+
// register `didLoadWithEvents` somewhere early in your app when it is ready to handle callkeep events.
612+
611613
RNCallKeep.addEventListener('didLoadWithEvents', (events) => {
612-
// see example usage in https://github.com/react-native-webrtc/react-native-callkeep/pull/169
614+
// `events` is passed as an Array chronologically, handle or ignore events based on the app's logic
615+
// see example usage in https://github.com/react-native-webrtc/react-native-callkeep/pull/169 or https://github.com/react-native-webrtc/react-native-callkeep/pull/205
613616
});
614617
```
615618

index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ class RNCallKeep {
2222

2323
constructor() {
2424
this._callkeepEventHandlers = new Map();
25-
26-
this.addEventListener('didLoadWithEvents', (events) => {
27-
events.forEach(event => {
28-
emit(event.name, event.data);
29-
});
30-
});
3125
}
3226

3327
addEventListener = (type, handler) => {

0 commit comments

Comments
 (0)