Skip to content

Commit 06d9543

Browse files
committed
Passing in RNCallKeep as argument for EventListener and removing instance variable.
1 parent ed80a99 commit 06d9543

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ const CONSTANTS = {
2020
export { emit, CONSTANTS };
2121

2222
class EventListener {
23-
constructor(type, listener) {
23+
constructor(type, listener, callkeep) {
2424
this._type = type;
2525
this._listener = listener;
26+
this._callkeep = callkeep;
2627
}
2728

2829
remove = () => {
29-
callKeep.removeEventListener(this._type, this._listener);
30+
this._callkeep.removeEventListener(this._type, this._listener);
3031
};
3132
}
3233

@@ -43,7 +44,7 @@ class RNCallKeep {
4344

4445
this._callkeepEventHandlers.set(type, listenerSet);
4546

46-
return new EventListener(type, listener);
47+
return new EventListener(type, listener, this);
4748
};
4849

4950
removeEventListener = (type, listener = undefined) => {
@@ -375,6 +376,4 @@ class RNCallKeep {
375376
}
376377
}
377378

378-
const callKeep = new RNCallKeep();
379-
380-
export default callKeep;
379+
export default new RNCallKeep();

0 commit comments

Comments
 (0)