@konemono/nostr-login 1.7.17 → 1.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ class ProcessManager extends EventEmitter {
|
|
|
27
27
|
|
|
28
28
|
let timeoutReject: ((reason?: any) => void) | undefined;
|
|
29
29
|
let isTimedOut = false;
|
|
30
|
+
let localTimer: NodeJS.Timeout | undefined;
|
|
30
31
|
|
|
31
32
|
const timeoutPromise = new Promise<T>((_, reject) => {
|
|
32
33
|
timeoutReject = reject;
|
|
@@ -34,7 +35,7 @@ class ProcessManager extends EventEmitter {
|
|
|
34
35
|
|
|
35
36
|
if (!this.callTimer) {
|
|
36
37
|
console.log('Setting up timeout timer for', CALL_TIMEOUT, 'ms');
|
|
37
|
-
|
|
38
|
+
localTimer = setTimeout(() => {
|
|
38
39
|
console.log('ProcessManager: timeout reached, emitting onCallTimeout');
|
|
39
40
|
isTimedOut = true;
|
|
40
41
|
this.emit('onCallTimeout');
|
|
@@ -42,6 +43,7 @@ class ProcessManager extends EventEmitter {
|
|
|
42
43
|
timeoutReject(new Error('[ProcessManager] Request timed out'));
|
|
43
44
|
}
|
|
44
45
|
}, CALL_TIMEOUT);
|
|
46
|
+
this.callTimer = localTimer;
|
|
45
47
|
} else {
|
|
46
48
|
console.log('Timer already exists, not setting up new one');
|
|
47
49
|
}
|
|
@@ -68,12 +70,12 @@ class ProcessManager extends EventEmitter {
|
|
|
68
70
|
this.emit('onCallEnd');
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
if
|
|
73
|
+
// Clear the timer if it's the one we created
|
|
74
|
+
if (this.callTimer === localTimer) {
|
|
72
75
|
clearTimeout(this.callTimer);
|
|
76
|
+
this.callTimer = undefined;
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
this.callTimer = undefined;
|
|
76
|
-
|
|
77
79
|
if (error) {
|
|
78
80
|
throw error;
|
|
79
81
|
}
|