anear-js-api 0.3.8 → 0.3.11
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.
|
@@ -95,7 +95,7 @@ class AnearMessaging {
|
|
|
95
95
|
let timerStarter = () => {}
|
|
96
96
|
|
|
97
97
|
if (timeoutMsecs > 0) {
|
|
98
|
-
|
|
98
|
+
const timer = this.participantTimers[participant.id] || this.createTimer(anearEvent, participant, timeoutMsecs)
|
|
99
99
|
|
|
100
100
|
if (timer.isPaused) {
|
|
101
101
|
timerRemaining = this.timeRemaining
|
|
@@ -129,14 +129,16 @@ class AnearMessaging {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
pauseParticipantTimer(participantId) {
|
|
132
|
-
const timer = this.participantTimers[
|
|
132
|
+
const timer = this.participantTimers[participantId]
|
|
133
|
+
|
|
134
|
+
logger.info("pauseParticipantTimer: ", timer)
|
|
133
135
|
|
|
134
136
|
if (timer && timer.isRunning) timer.pause()
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
resetParticipantTimer(participantId) {
|
|
138
140
|
// called after participant takes Action before timer expires
|
|
139
|
-
const timer = this.participantTimers[
|
|
141
|
+
const timer = this.participantTimers[participantId]
|
|
140
142
|
if (timer) timer.reset()
|
|
141
143
|
}
|
|
142
144
|
|
|
@@ -433,12 +435,11 @@ class AnearMessaging {
|
|
|
433
435
|
}
|
|
434
436
|
|
|
435
437
|
async participantLeaveMessagingCallback(anearEvent, message) {
|
|
436
|
-
// this can be just a temporary leave (refresh browser for example), so
|
|
437
|
-
// for now
|
|
438
|
+
// this can be just a temporary leave (refresh browser for example), so pause any participant timers
|
|
438
439
|
const userId = message.clientId
|
|
439
|
-
const participantId = message.data.
|
|
440
|
+
const participantId = message.data.id
|
|
440
441
|
|
|
441
|
-
logger.debug(`**** LEAVE PARTICIPANT **** participantLeaveMessagingCallback(
|
|
442
|
+
logger.debug(`**** LEAVE PARTICIPANT **** participantLeaveMessagingCallback(participant: ${participantId})`)
|
|
442
443
|
|
|
443
444
|
// pause the participant timer if one was active. The participant may return shortly
|
|
444
445
|
// and we can resume this timer
|