mol_wire_lib 1.0.115 → 1.0.118

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/node.js CHANGED
@@ -55,37 +55,38 @@ var $;
55
55
  "use strict";
56
56
  var $;
57
57
  (function ($) {
58
- class $mol_wire_pub extends Array {
58
+ class $mol_wire_pub extends Object {
59
+ data = [];
59
60
  static get [Symbol.species]() {
60
61
  return Array;
61
62
  }
62
63
  sub_from = 0;
63
64
  get sub_list() {
64
65
  const res = [];
65
- for (let i = this.sub_from; i < this.length; i += 2) {
66
- res.push(this[i]);
66
+ for (let i = this.sub_from; i < this.data.length; i += 2) {
67
+ res.push(this.data[i]);
67
68
  }
68
69
  return res;
69
70
  }
70
71
  get sub_empty() {
71
- return this.sub_from === this.length;
72
+ return this.sub_from === this.data.length;
72
73
  }
73
74
  sub_on(sub, pub_pos) {
74
- const pos = this.length;
75
- this.push(sub, pub_pos);
75
+ const pos = this.data.length;
76
+ this.data.push(sub, pub_pos);
76
77
  return pos;
77
78
  }
78
79
  sub_off(sub_pos) {
79
- if (!(sub_pos < this.length)) {
80
+ if (!(sub_pos < this.data.length)) {
80
81
  $mol_fail(new Error(`Wrong pos ${sub_pos}`));
81
82
  }
82
- const end = this.length - 2;
83
+ const end = this.data.length - 2;
83
84
  if (sub_pos !== end) {
84
85
  this.peer_move(end, sub_pos);
85
86
  }
86
- this.pop();
87
- this.pop();
88
- if (this.length === this.sub_from)
87
+ this.data.pop();
88
+ this.data.pop();
89
+ if (this.data.length === this.sub_from)
89
90
  this.reap();
90
91
  }
91
92
  reap() { }
@@ -95,20 +96,20 @@ var $;
95
96
  refresh() { }
96
97
  complete() { }
97
98
  emit(quant = $mol_wire_cursor.stale) {
98
- for (let i = this.sub_from; i < this.length; i += 2) {
99
+ for (let i = this.sub_from; i < this.data.length; i += 2) {
99
100
  ;
100
- this[i].absorb(quant);
101
+ this.data[i].absorb(quant);
101
102
  }
102
103
  }
103
104
  peer_move(from_pos, to_pos) {
104
- const peer = this[from_pos];
105
- const self_pos = this[from_pos + 1];
106
- this[to_pos] = peer;
107
- this[to_pos + 1] = self_pos;
105
+ const peer = this.data[from_pos];
106
+ const self_pos = this.data[from_pos + 1];
107
+ this.data[to_pos] = peer;
108
+ this.data[to_pos + 1] = self_pos;
108
109
  peer.peer_repos(self_pos, to_pos);
109
110
  }
110
111
  peer_repos(peer_pos, self_pos) {
111
- this[peer_pos + 1] = self_pos;
112
+ this.data[peer_pos + 1] = self_pos;
112
113
  }
113
114
  }
114
115
  $.$mol_wire_pub = $mol_wire_pub;
@@ -240,7 +241,7 @@ var $;
240
241
  const res = [];
241
242
  const max = this.cursor >= 0 ? this.cursor : this.sub_from;
242
243
  for (let i = this.pub_from; i < max; i += 2) {
243
- res.push(this[i]);
244
+ res.push(this.data[i]);
244
245
  }
245
246
  return res;
246
247
  }
@@ -260,7 +261,7 @@ var $;
260
261
  if (this.cursor < 0)
261
262
  $mol_fail(new Error('Promo to non begun sub'));
262
263
  if (this.cursor < this.sub_from) {
263
- const next = this[this.cursor];
264
+ const next = this.data[this.cursor];
264
265
  if (pub === undefined)
265
266
  return next ?? null;
266
267
  if (next === pub) {
@@ -268,8 +269,8 @@ var $;
268
269
  return next;
269
270
  }
270
271
  if (next) {
271
- if (this.sub_from < this.length) {
272
- this.peer_move(this.sub_from, this.length);
272
+ if (this.sub_from < this.data.length) {
273
+ this.peer_move(this.sub_from, this.data.length);
273
274
  }
274
275
  this.peer_move(this.cursor, this.sub_from);
275
276
  this.sub_from += 2;
@@ -278,13 +279,13 @@ var $;
278
279
  else {
279
280
  if (pub === undefined)
280
281
  return null;
281
- if (this.sub_from < this.length) {
282
- this.peer_move(this.sub_from, this.length);
282
+ if (this.sub_from < this.data.length) {
283
+ this.peer_move(this.sub_from, this.data.length);
283
284
  }
284
285
  this.sub_from += 2;
285
286
  }
286
- this[this.cursor] = pub;
287
- this[this.cursor + 1] = pub.sub_on(this, this.cursor);
287
+ this.data[this.cursor] = pub;
288
+ this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
288
289
  this.cursor += 2;
289
290
  return pub;
290
291
  }
@@ -294,22 +295,22 @@ var $;
294
295
  $mol_fail(new Error('End of non begun sub'));
295
296
  }
296
297
  for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
297
- const pub = this[cursor];
298
+ const pub = this.data[cursor];
298
299
  pub.refresh();
299
300
  }
300
301
  this.cursor = $mol_wire_cursor.fresh;
301
302
  }
302
303
  pub_off(sub_pos) {
303
- this[sub_pos] = undefined;
304
- this[sub_pos + 1] = undefined;
304
+ this.data[sub_pos] = undefined;
305
+ this.data[sub_pos + 1] = undefined;
305
306
  }
306
307
  destructor() {
307
- for (let cursor = this.length - 2; cursor >= this.sub_from; cursor -= 2) {
308
- const sub = this[cursor];
309
- const pos = this[cursor + 1];
308
+ for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
309
+ const sub = this.data[cursor];
310
+ const pos = this.data[cursor + 1];
310
311
  sub.pub_off(pos);
311
- this.pop();
312
- this.pop();
312
+ this.data.pop();
313
+ this.data.pop();
313
314
  }
314
315
  this.cursor = this.pub_from;
315
316
  this.track_cut();
@@ -321,20 +322,20 @@ var $;
321
322
  }
322
323
  let tail = 0;
323
324
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
324
- const pub = this[cursor];
325
- pub?.sub_off(this[cursor + 1]);
326
- if (this.sub_from < this.length) {
327
- this.peer_move(this.length - 2, cursor);
328
- this.pop();
329
- this.pop();
325
+ const pub = this.data[cursor];
326
+ pub?.sub_off(this.data[cursor + 1]);
327
+ if (this.sub_from < this.data.length) {
328
+ this.peer_move(this.data.length - 2, cursor);
329
+ this.data.pop();
330
+ this.data.pop();
330
331
  }
331
332
  else {
332
333
  ++tail;
333
334
  }
334
335
  }
335
336
  for (; tail; --tail) {
336
- this.pop();
337
- this.pop();
337
+ this.data.pop();
338
+ this.data.pop();
338
339
  }
339
340
  this.sub_from = this.cursor;
340
341
  }
@@ -342,7 +343,7 @@ var $;
342
343
  complete_pubs() {
343
344
  const limit = this.cursor < 0 ? this.sub_from : this.cursor;
344
345
  for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
345
- const pub = this[cursor];
346
+ const pub = this.data[cursor];
346
347
  pub?.complete();
347
348
  }
348
349
  }
@@ -601,7 +602,7 @@ var $;
601
602
  }
602
603
  cache = undefined;
603
604
  get args() {
604
- return this.slice(0, this.pub_from);
605
+ return this.data.slice(0, this.pub_from);
605
606
  }
606
607
  result() {
607
608
  if (this.cache instanceof Promise)
@@ -614,11 +615,10 @@ var $;
614
615
  return this.task.name + '()';
615
616
  }
616
617
  constructor(id, task, host, ...args) {
617
- super(...args, undefined, undefined);
618
+ super();
618
619
  this.task = task;
619
620
  this.host = host;
620
- this.pop();
621
- this.pop();
621
+ this.data.push(...args);
622
622
  this.pub_from = this.sub_from = args.length;
623
623
  this[Symbol.toStringTag] = id;
624
624
  }
@@ -662,7 +662,7 @@ var $;
662
662
  check: if (this.cursor === $mol_wire_cursor.doubt) {
663
663
  for (let i = this.pub_from; i < this.sub_from; i += 2) {
664
664
  ;
665
- this[i]?.refresh();
665
+ this.data[i]?.refresh();
666
666
  if (this.cursor !== $mol_wire_cursor.doubt)
667
667
  break check;
668
668
  }
@@ -677,10 +677,10 @@ var $;
677
677
  result = this.task.call(this.host);
678
678
  break;
679
679
  case 1:
680
- result = this.task.call(this.host, this[0]);
680
+ result = this.task.call(this.host, this.data[0]);
681
681
  break;
682
682
  default:
683
- result = this.task.call(this.host, ...this.slice(0, this.pub_from));
683
+ result = this.task.call(this.host, ...this.data.slice(0, this.pub_from));
684
684
  break;
685
685
  }
686
686
  if (result instanceof Promise) {
@@ -1078,7 +1078,7 @@ var $;
1078
1078
  }
1079
1079
  catch { }
1080
1080
  }
1081
- if (this.sub_from < this.length) {
1081
+ if (this.sub_from < this.data.length) {
1082
1082
  if (!$mol_compare_deep(prev, next)) {
1083
1083
  this.emit();
1084
1084
  }