hyoo_sync_client 0.0.586 → 0.0.588

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
@@ -1023,9 +1023,8 @@ var $;
1023
1023
  if (sub_pos !== end) {
1024
1024
  this.peer_move(end, sub_pos);
1025
1025
  }
1026
- this.data.pop();
1027
- this.data.pop();
1028
- if (this.data.length === this.sub_from)
1026
+ this.data.length = end;
1027
+ if (end === this.sub_from)
1029
1028
  this.reap();
1030
1029
  }
1031
1030
  reap() { }
@@ -1155,9 +1154,8 @@ var $;
1155
1154
  const sub = this.data[cursor];
1156
1155
  const pos = this.data[cursor + 1];
1157
1156
  sub.pub_off(pos);
1158
- this.data.pop();
1159
- this.data.pop();
1160
1157
  }
1158
+ this.data.length = this.sub_from;
1161
1159
  this.cursor = this.pub_from;
1162
1160
  this.track_cut();
1163
1161
  this.cursor = $mol_wire_cursor.final;
@@ -1166,23 +1164,15 @@ var $;
1166
1164
  if (this.cursor < this.pub_from) {
1167
1165
  $mol_fail(new Error('Cut of non begun sub'));
1168
1166
  }
1169
- let tail = 0;
1167
+ let end = this.data.length;
1170
1168
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
1171
1169
  const pub = this.data[cursor];
1172
1170
  pub?.sub_off(this.data[cursor + 1]);
1173
- if (this.sub_from < this.data.length) {
1174
- this.peer_move(this.data.length - 2, cursor);
1175
- this.data.pop();
1176
- this.data.pop();
1177
- }
1178
- else {
1179
- ++tail;
1180
- }
1181
- }
1182
- for (; tail; --tail) {
1183
- this.data.pop();
1184
- this.data.pop();
1171
+ end -= 2;
1172
+ if (this.sub_from <= end)
1173
+ this.peer_move(end, cursor);
1185
1174
  }
1175
+ this.data.length = end;
1186
1176
  this.sub_from = this.cursor;
1187
1177
  }
1188
1178
  complete() { }