anear-js-api 0.3.11 → 0.3.14

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.
@@ -98,12 +98,14 @@ class AnearMessaging {
98
98
  const timer = this.participantTimers[participant.id] || this.createTimer(anearEvent, participant, timeoutMsecs)
99
99
 
100
100
  if (timer.isPaused) {
101
- timerRemaining = this.timeRemaining
101
+ timeRemaining = this.timeRemaining
102
102
  timerStarter = () => timer.resume()
103
103
  } else {
104
104
  timerStarter = () => timer.start(timeoutMsecs)
105
105
  }
106
106
  }
107
+ logger.debug(`ensureParticipant(timeRemaining: ${timeRemaining})`)
108
+
107
109
  return [timerStarter, timeRemaining]
108
110
  }
109
111
 
@@ -131,8 +133,6 @@ class AnearMessaging {
131
133
  pauseParticipantTimer(participantId) {
132
134
  const timer = this.participantTimers[participantId]
133
135
 
134
- logger.info("pauseParticipantTimer: ", timer)
135
-
136
136
  if (timer && timer.isRunning) timer.pause()
137
137
  }
138
138
 
@@ -442,7 +442,7 @@ class AnearMessaging {
442
442
  logger.debug(`**** LEAVE PARTICIPANT **** participantLeaveMessagingCallback(participant: ${participantId})`)
443
443
 
444
444
  // pause the participant timer if one was active. The participant may return shortly
445
- // and we can resume this timer
445
+ // and we can resume this timer.
446
446
  this.pauseParticipantTimer(participantId)
447
447
  }
448
448
 
@@ -646,6 +646,8 @@ class AnearMessaging {
646
646
  timeout: { timeoutMsecs, timeRemaining }
647
647
  }
648
648
 
649
+ logger.debug(`publishMessage(timeoutMsecs=${timeoutMsecs}}, timeRemaining=${timeRemaining})`)
650
+
649
651
  await this.publishChannelMessage(
650
652
  channel,
651
653
  messageType,
@@ -163,13 +163,13 @@ class AnearEvent extends JsonApiResource {
163
163
  await this.spectatorRefreshEventCallback()
164
164
  }
165
165
 
166
- async publishEventParticipantsMessage(message, timeoutMilliseconds=0) {
166
+ async publishEventParticipantsMessage(message, timeoutMsecs=0) {
167
167
  await this.messaging.publishEventParticipantsMessage(
168
168
  this,
169
169
  this.participants.active,
170
170
  this.css,
171
171
  message,
172
- timeoutMilliseconds
172
+ timeoutMsecs
173
173
  )
174
174
  }
175
175
 
@@ -177,14 +177,14 @@ class AnearEvent extends JsonApiResource {
177
177
  await this.messaging.publishEventSpectatorsMessage(this, this.css, message)
178
178
  }
179
179
 
180
- async publishEventPrivateMessage(participant, message, timeoutMilliseconds=0) {
180
+ async publishEventPrivateMessage(participant, message, timeoutMsecs=0) {
181
181
  await this.messaging.publishEventPrivateMessage(
182
182
  this,
183
183
  participant,
184
184
  PrivateDisplayMessageType,
185
185
  this.css,
186
186
  message,
187
- timeoutMilliseconds
187
+ timeoutMsecs
188
188
  )
189
189
  }
190
190
 
@@ -131,9 +131,7 @@ class Participants {
131
131
  // the host is not an eligible participant and isn't active nor idle
132
132
  this._host = rec
133
133
  } else {
134
- this._participants[anearParticipant.id] = rec
135
- anearParticipant.timestamp = this.currentTimestamp
136
- anearParticipant.state = ActiveState
134
+ this.markActive(anearParticipant)
137
135
  }
138
136
  return rec
139
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anear-js-api",
3
- "version": "0.3.11",
3
+ "version": "0.3.14",
4
4
  "description": "Javascript Developer API for Anear Apps",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {