@yz-social/webrtc 0.1.12 → 0.1.13

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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -67,7 +67,7 @@ export class WebRTC {
67
67
  this.pc.ondatachannel = e => this.ondatachannel(e.channel);
68
68
  this.pc.onicecandidateerror = error => {
69
69
  const {errorCode, errorText, url, address, port} = error;
70
- this.flog(`${errorCode}: ${errorText || '(ice failure)'} ${address}:${port} @${url}`);
70
+ this.log(`${errorCode}: ${errorText || '(ice failure)'} ${address}:${port} @${url}`);
71
71
  };
72
72
  this.pc.oniceconnectionstatechange = () => {
73
73
  if (!this.pc) return;
@@ -203,13 +203,13 @@ export class WebRTC {
203
203
  pendingSignals = [];
204
204
  responseSerializer = Promise.resolve();
205
205
  async respond(signals = []) { // Apply a list of signals, and promise a list of responding signals as soon as any are available, or empty list when connected
206
- // This is used by a peer that is receiving signals in an out-of-band network request, and witing for a response. (Compare transferSignals.)
206
+ // This is used by a peer that is receiving signals in an out-of-band network request, and waiting for a response. (Compare transferSignals.)
207
207
  return this.responseSerializer = this.responseSerializer.then(async () => {
208
208
  this.log('respond', signals.length, 'signals');
209
- const {promise, resolve} = Promise.withResolvers;
209
+ const {promise, resolve} = Promise.withResolvers();
210
210
  this.signalsReadyResolver = resolve;
211
211
  await this.onSignals(signals);
212
- await promise;
212
+ if (!this.pendingSignals.length) await promise;
213
213
  this.signalsReadyResolver = null;
214
214
  return this.collectPendingSignals();
215
215
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yz-social/webrtc",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Streamlined portable webrtc management of p2p and client2server.",
5
5
  "keywords": [
6
6
  "webrtc",