mol_wire_lib 1.0.1280 → 1.0.1282

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/web.mjs CHANGED
@@ -84,9 +84,8 @@ var $;
84
84
  if (sub_pos !== end) {
85
85
  this.peer_move(end, sub_pos);
86
86
  }
87
- this.data.pop();
88
- this.data.pop();
89
- if (this.data.length === this.sub_from)
87
+ this.data.length = end;
88
+ if (end === this.sub_from)
90
89
  this.reap();
91
90
  }
92
91
  reap() { }
@@ -318,9 +317,8 @@ var $;
318
317
  const sub = this.data[cursor];
319
318
  const pos = this.data[cursor + 1];
320
319
  sub.pub_off(pos);
321
- this.data.pop();
322
- this.data.pop();
323
320
  }
321
+ this.sub_from = this.pub_from;
324
322
  this.cursor = this.pub_from;
325
323
  this.track_cut();
326
324
  this.cursor = $mol_wire_cursor.final;
@@ -329,23 +327,15 @@ var $;
329
327
  if (this.cursor < this.pub_from) {
330
328
  $mol_fail(new Error('Cut of non begun sub'));
331
329
  }
332
- let tail = 0;
330
+ let end = this.data.length;
333
331
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
334
332
  const pub = this.data[cursor];
335
333
  pub?.sub_off(this.data[cursor + 1]);
336
- if (this.sub_from < this.data.length) {
337
- this.peer_move(this.data.length - 2, cursor);
338
- this.data.pop();
339
- this.data.pop();
340
- }
341
- else {
342
- ++tail;
343
- }
344
- }
345
- for (; tail; --tail) {
346
- this.data.pop();
347
- this.data.pop();
334
+ end -= 2;
335
+ if (this.sub_from <= end)
336
+ this.peer_move(end, cursor);
348
337
  }
338
+ this.data.length = end;
349
339
  this.sub_from = this.cursor;
350
340
  }
351
341
  complete() { }