mol_wire_pub 1.0.38 → 1.0.42
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.d.ts +2 -2
- package/node.deps.json +1 -1
- package/node.esm.js +6 -6
- package/node.esm.js.map +1 -1
- package/node.js +6 -6
- package/node.js.map +1 -1
- package/node.test.js +18 -20
- package/node.test.js.map +1 -1
- package/package.json +3 -3
- package/web.d.ts +2 -2
- package/web.deps.json +1 -1
- package/web.esm.js +6 -6
- package/web.esm.js.map +1 -1
- package/web.js +6 -6
- package/web.js.map +1 -1
- package/web.test.js +12 -14
- package/web.test.js.map +1 -1
package/node.d.ts
CHANGED
|
@@ -39,7 +39,6 @@ declare namespace $ {
|
|
|
39
39
|
up(): void;
|
|
40
40
|
down(): void;
|
|
41
41
|
emit(quant?: $mol_wire_cursor): void;
|
|
42
|
-
absorb(quant?: $mol_wire_cursor): boolean;
|
|
43
42
|
peer_move(from_pos: number, to_pos: number): void;
|
|
44
43
|
peer_repos(peer_pos: number, self_pos: number): void;
|
|
45
44
|
}
|
|
@@ -52,12 +51,13 @@ declare namespace $ {
|
|
|
52
51
|
pub_off(pub_pos: number): void;
|
|
53
52
|
track_cut(sub: $mol_wire_pub | null): void;
|
|
54
53
|
track_off(sub: $mol_wire_pub | null): void;
|
|
54
|
+
absorb(quant: $mol_wire_cursor): void;
|
|
55
55
|
destructor(): void;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
declare namespace $ {
|
|
60
|
-
|
|
60
|
+
function $mol_wire_auto(next?: $mol_wire_sub | null): $mol_wire_sub | null;
|
|
61
61
|
const $mol_wire_affected: (number | $mol_wire_sub)[];
|
|
62
62
|
}
|
|
63
63
|
|
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/
|
|
1
|
+
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/wire/cursor":{"mol/wire/sub":-2,"mol/wire/pub":-2},"mol/fail":{"mol/wire/pub":-4}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-2},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1,"mol/wire/cursor":-2},"mol/wire/cursor":{},"mol/fail":{"mol":-9007199254740991}},"sloc":{"LICENSE":113,"md":602,"tree":31,"js":10,"ts":170,"json":85,"lock":939,"CNAME":1,"html":1},"deps":{"mol/wire/pub":{"..":-9007199254740991,"/mol/wire/pub":-1,"/mol/wire/sub":-3,"/mol/fail":-4,"/mol/wire/auto":-3,"/mol/wire/cursor/stale":-2},"mol/wire":{"..":-9007199254740991,"/mol/wire/sub":-1,"/mol/wire/auto":-1,"/mol/wire/affected":-1},"mol":{"..":-9007199254740991},"":{},"mol/wire/sub":{"..":-9007199254740991,"/mol/wire/sub":-1,"/mol/wire/pub":-1,"/mol/wire/cursor":-2},"mol/wire/cursor":{"..":-9007199254740991,"/mol/wire/cursor":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1}}}
|
package/node.esm.js
CHANGED
|
@@ -90,7 +90,7 @@ var $;
|
|
|
90
90
|
}
|
|
91
91
|
reap() { }
|
|
92
92
|
promote() {
|
|
93
|
-
$mol_wire_auto?.track_next(this);
|
|
93
|
+
$mol_wire_auto()?.track_next(this);
|
|
94
94
|
}
|
|
95
95
|
up() { }
|
|
96
96
|
down() { }
|
|
@@ -100,10 +100,6 @@ var $;
|
|
|
100
100
|
this[i].absorb(quant);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
absorb(quant = $mol_wire_cursor.stale) {
|
|
104
|
-
this.emit($mol_wire_cursor.doubt);
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
103
|
peer_move(from_pos, to_pos) {
|
|
108
104
|
const peer = this[from_pos];
|
|
109
105
|
const self_pos = this[from_pos + 1];
|
|
@@ -125,7 +121,11 @@ var $;
|
|
|
125
121
|
"use strict";
|
|
126
122
|
var $;
|
|
127
123
|
(function ($) {
|
|
128
|
-
|
|
124
|
+
let auto = null;
|
|
125
|
+
function $mol_wire_auto(next = auto) {
|
|
126
|
+
return auto = next;
|
|
127
|
+
}
|
|
128
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
129
129
|
$.$mol_wire_affected = [];
|
|
130
130
|
})($ || ($ = {}));
|
|
131
131
|
//mol/wire/wire.ts
|
package/node.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../../fail/mol/fail/fail.ts","../../cursor/mol/wire/cursor/cursor.ts","../mol/wire/pub/pub.ts","../../sub/sub.ts","../../mol/wire/wire.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IAEV,SAAgB,SAAS,CAAE,KAAW;QACrC,MAAM,KAAK,CAAA;IACZ,CAAC;IAFe,WAAS,YAExB,CAAA;AAEF,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;;;;ACND,IAAU,CAAC,CAmBV;AAnBD,WAAU,CAAC;IAGV,IAAY,gBAcX;IAdD,WAAY,gBAAgB;QAG3B,0DAAU,CAAA;QAGV,0DAAU,CAAA;QAGV,0DAAU,CAAA;QAGV,0DAAU,CAAA;IAEX,CAAC,EAdW,gBAAgB,GAAhB,kBAAgB,KAAhB,kBAAgB,QAc3B;AAEF,CAAC,EAnBS,CAAC,KAAD,CAAC,QAmBV;;;;ACnBD,IAAU,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../../fail/mol/fail/fail.ts","../../cursor/mol/wire/cursor/cursor.ts","../mol/wire/pub/pub.ts","../../sub/sub.ts","../../mol/wire/wire.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;A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M,CAAE,CAAA;QACpC,CAAC;QAKD,UAAU,CAAE,QAAgB,EAAE,QAAgB;YAC7C,IAAI,CAAE,QAAQ,GAAG,CAAC,CAAE,GAAG,QAAQ,CAAA;QAChC,CAAC;KAED;IAhHY,eAAa,gBAgHzB,CAAA;AAEF,CAAC,EAvHS,CAAC,KAAD,CAAC,QAuHV;;;ACvHD;AACA;AACA;;ACFA,IAAU,CAAC,CAgBV;AAhBD,WAAU,CAAC;IAEV,IAAI,IAAI,GAAyB,IAAI,CAAA;IAKrC,SAAgB,cAAc,CAAE,IAAI,GAAG,IAAI;QAC1C,OAAO,IAAI,GAAG,IAAI,CAAA;IACnB,CAAC;IAFe,gBAAc,iBAE7B,CAAA;IAKY,oBAAkB,GAAG,EAAkC,CAAA;AAErE,CAAC,EAhBS,CAAC,KAAD,CAAC,QAgBV;;;ANhBD","file":"node.esm.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\n\texport function $mol_fail( error : any ) : never {\n\t\tthrow error\n\t}\n\n}\n","namespace $ {\n\t\n\t/** Special status statuses. */\n\texport enum $mol_wire_cursor {\n\t\t\n\t\t/** Update required. */\n\t\tstale = -1,\n\t\t\n\t\t/** Some of (transitive) pub update required. */\n\t\tdoubt = -2,\n\t\t\n\t\t/** Actual state but may be dropped. */\n\t\tfresh = -3,\n\t\t\n\t\t/** State will never be changed. */\n\t\tfinal = -4,\n\t\t\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/**\n\t * Collects subscribers in compact array. 28B\n\t */\n\texport class $mol_wire_pub extends Array< unknown > {\n\t\t\n\t\t// Derived objects should be Arrays.\n\t\tstatic get [ Symbol.species ]() {\n\t\t\treturn Array\n\t\t}\n\t\t\n\t\t/**\n\t\t * Index of first subscriber.\n\t\t */\n\t\tprotected sub_from = 0 // 4B\n\t\t\n\t\t/**\n\t\t * All current subscribers.\n\t\t */\n\t\tget sub_list() {\n\t\t\tconst res = [] as $mol_wire_sub[]\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\tres.push( this[i] as $mol_wire_sub )\n\t\t\t}\n\t\t\treturn res as readonly $mol_wire_sub[]\n\t\t}\n\t\t\n\t\t/**\n\t\t * Has any subscribers or not.\n\t\t */\n\t\tget sub_empty() {\n\t\t\treturn this.sub_from === this.length\n\t\t}\n\t\t\n\t\t/**\n\t\t * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.\n\t\t */\n\t\tsub_on( sub: $mol_wire_pub, pub_pos: number ) {\n\t\t\tconst pos = this.length\n\t\t\tthis.push( sub, pub_pos )\n\t\t\treturn pos\n\t\t}\n\t\t\n\t\t/**\n\t\t * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.\n\t\t */\n\t\tsub_off( sub_pos: number ) {\n\t\t\t\n\t\t\tif(!( sub_pos < this.length )) {\n\t\t\t\t$mol_fail( new Error( `Wrong pos ${ sub_pos }` ) )\n\t\t\t}\n\t\t\t\n\t\t\tconst end = this.length - 2\n\t\t\tif( sub_pos !== end ) {\n\t\t\t\tthis.peer_move( end, sub_pos )\n\t\t\t}\n\t\t\t\n\t\t\tthis.pop()\n\t\t\tthis.pop()\n\t\t\t\n\t\t\tif( this.length === this.sub_from ) this.reap()\n\t\t\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * Called when last sub was unsubscribed.\n\t\t **/\n\t\treap() { }\n\t\t\n\t\t/**\n\t\t * Autowire this publisher with current subscriber.\n\t\t **/\n\t\tpromote() {\n\t\t\t$mol_wire_auto()?.track_next( this )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Enforce actualization. Should not throw errors.\n\t\t */\n\t\tup() {}\n\t\t\n\t\t/**\n\t\t * Subscriber stabilized and allows to free.\n\t\t */\n\t\tdown() {}\n\t\t\n\t\t/**\n\t\t * Notify subscribers about self changes.\n\t\t */\n\t\temit( quant = $mol_wire_cursor.stale ) {\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\t;( this[i] as $mol_wire_sub ).absorb( quant )\n\t\t\t}\n\t\t}\n\t\t\n\t\t/**\n\t\t * Moves peer from one position to another. Doesn't clear data at old position!\n\t\t */\n\t\tpeer_move( from_pos: number, to_pos: number ) {\n\t\t\t\n\t\t\tconst peer = this[ from_pos ] as $mol_wire_pub\n\t\t\tconst self_pos = this[ from_pos + 1 ] as number\n\t\t\t\n\t\t\tthis[ to_pos ] = peer\n\t\t\tthis[ to_pos + 1 ] = self_pos\n\t\t\t\n\t\t\tpeer.peer_repos( self_pos, to_pos )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Updates self position in the peer.\n\t\t */\n\t\tpeer_repos( peer_pos: number, self_pos: number ) {\n\t\t\tthis[ peer_pos + 1 ] = self_pos\n\t\t}\n\t\t\n\t}\n\t\n}\n",null,"namespace $ {\n\t\n\tlet auto: $mol_wire_sub | null = null\n\t\n\t/**\n\t * When fulfilled, all publishers are promoted to this subscriber on access to its.\n\t */\n\texport function $mol_wire_auto( next = auto ) {\n\t\treturn auto = next\n\t}\n\t\n\t/**\n\t * Affection queue. Used to prevent accidental stack overflow on emit.\n\t */\n\texport const $mol_wire_affected = [] as ( $mol_wire_sub | number )[]\n\t\n}\n"]}
|
package/node.js
CHANGED
|
@@ -90,7 +90,7 @@ var $;
|
|
|
90
90
|
}
|
|
91
91
|
reap() { }
|
|
92
92
|
promote() {
|
|
93
|
-
$mol_wire_auto?.track_next(this);
|
|
93
|
+
$mol_wire_auto()?.track_next(this);
|
|
94
94
|
}
|
|
95
95
|
up() { }
|
|
96
96
|
down() { }
|
|
@@ -100,10 +100,6 @@ var $;
|
|
|
100
100
|
this[i].absorb(quant);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
absorb(quant = $mol_wire_cursor.stale) {
|
|
104
|
-
this.emit($mol_wire_cursor.doubt);
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
103
|
peer_move(from_pos, to_pos) {
|
|
108
104
|
const peer = this[from_pos];
|
|
109
105
|
const self_pos = this[from_pos + 1];
|
|
@@ -125,7 +121,11 @@ var $;
|
|
|
125
121
|
"use strict";
|
|
126
122
|
var $;
|
|
127
123
|
(function ($) {
|
|
128
|
-
|
|
124
|
+
let auto = null;
|
|
125
|
+
function $mol_wire_auto(next = auto) {
|
|
126
|
+
return auto = next;
|
|
127
|
+
}
|
|
128
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
129
129
|
$.$mol_wire_affected = [];
|
|
130
130
|
})($ || ($ = {}));
|
|
131
131
|
//mol/wire/wire.ts
|
package/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../../fail/mol/fail/fail.ts","../../cursor/mol/wire/cursor/cursor.ts","../mol/wire/pub/pub.ts","../../sub/sub.ts","../../mol/wire/wire.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IAEV,SAAgB,SAAS,CAAE,KAAW;QACrC,MAAM,KAAK,CAAA;IACZ,CAAC;IAFe,WAAS,YAExB,CAAA;AAEF,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;;;;ACND,IAAU,CAAC,CAmBV;AAnBD,WAAU,CAAC;IAGV,IAAY,gBAcX;IAdD,WAAY,gBAAgB;QAG3B,0DAAU,CAAA;QAGV,0DAAU,CAAA;QAGV,0DAAU,CAAA;QAGV,0DAAU,CAAA;IAEX,CAAC,EAdW,gBAAgB,GAAhB,kBAAgB,KAAhB,kBAAgB,QAc3B;AAEF,CAAC,EAnBS,CAAC,KAAD,CAAC,QAmBV;;;;ACnBD,IAAU,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../../fail/mol/fail/fail.ts","../../cursor/mol/wire/cursor/cursor.ts","../mol/wire/pub/pub.ts","../../sub/sub.ts","../../mol/wire/wire.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IAEV,SAAgB,SAAS,CAAE,KAAW;QACrC,MAAM,KAAK,CAAA;IACZ,CAAC;IAFe,WAAS,YAExB,CAAA;AAEF,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;;;;ACND,IAAU,CAAC,CAmBV;AAnBD,WAAU,CAAC;IAGV,IAAY,gBAcX;IAdD,WAAY,gBAAgB;QAG3B,0DAAU,CAAA;QAGV,0DAAU,CAAA;QAGV,0DAAU,CAAA;QAGV,0DAAU,CAAA;IAEX,CAAC,EAdW,gBAAgB,GAAhB,kBAAgB,KAAhB,kBAAgB,QAc3B;AAEF,CAAC,EAnBS,CAAC,KAAD,CAAC,QAmBV;;;;ACnBD,IAAU,CAAC,CAuHV;AAvHD,WAAU,CAAC;IAKV,MAAa,aAAc,SAAQ,KAAgB;QAGlD,MAAM,KAAK,CAAE,MAAM,CAAC,OAAO,CAAE;YAC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eof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\n\texport function $mol_fail( error : any ) : never {\n\t\tthrow error\n\t}\n\n}\n","namespace $ {\n\t\n\t/** Special status statuses. */\n\texport enum $mol_wire_cursor {\n\t\t\n\t\t/** Update required. */\n\t\tstale = -1,\n\t\t\n\t\t/** Some of (transitive) pub update required. */\n\t\tdoubt = -2,\n\t\t\n\t\t/** Actual state but may be dropped. */\n\t\tfresh = -3,\n\t\t\n\t\t/** State will never be changed. */\n\t\tfinal = -4,\n\t\t\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/**\n\t * Collects subscribers in compact array. 28B\n\t */\n\texport class $mol_wire_pub extends Array< unknown > {\n\t\t\n\t\t// Derived objects should be Arrays.\n\t\tstatic get [ Symbol.species ]() {\n\t\t\treturn Array\n\t\t}\n\t\t\n\t\t/**\n\t\t * Index of first subscriber.\n\t\t */\n\t\tprotected sub_from = 0 // 4B\n\t\t\n\t\t/**\n\t\t * All current subscribers.\n\t\t */\n\t\tget sub_list() {\n\t\t\tconst res = [] as $mol_wire_sub[]\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\tres.push( this[i] as $mol_wire_sub )\n\t\t\t}\n\t\t\treturn res as readonly $mol_wire_sub[]\n\t\t}\n\t\t\n\t\t/**\n\t\t * Has any subscribers or not.\n\t\t */\n\t\tget sub_empty() {\n\t\t\treturn this.sub_from === this.length\n\t\t}\n\t\t\n\t\t/**\n\t\t * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.\n\t\t */\n\t\tsub_on( sub: $mol_wire_pub, pub_pos: number ) {\n\t\t\tconst pos = this.length\n\t\t\tthis.push( sub, pub_pos )\n\t\t\treturn pos\n\t\t}\n\t\t\n\t\t/**\n\t\t * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.\n\t\t */\n\t\tsub_off( sub_pos: number ) {\n\t\t\t\n\t\t\tif(!( sub_pos < this.length )) {\n\t\t\t\t$mol_fail( new Error( `Wrong pos ${ sub_pos }` ) )\n\t\t\t}\n\t\t\t\n\t\t\tconst end = this.length - 2\n\t\t\tif( sub_pos !== end ) {\n\t\t\t\tthis.peer_move( end, sub_pos )\n\t\t\t}\n\t\t\t\n\t\t\tthis.pop()\n\t\t\tthis.pop()\n\t\t\t\n\t\t\tif( this.length === this.sub_from ) this.reap()\n\t\t\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * Called when last sub was unsubscribed.\n\t\t **/\n\t\treap() { }\n\t\t\n\t\t/**\n\t\t * Autowire this publisher with current subscriber.\n\t\t **/\n\t\tpromote() {\n\t\t\t$mol_wire_auto()?.track_next( this )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Enforce actualization. Should not throw errors.\n\t\t */\n\t\tup() {}\n\t\t\n\t\t/**\n\t\t * Subscriber stabilized and allows to free.\n\t\t */\n\t\tdown() {}\n\t\t\n\t\t/**\n\t\t * Notify subscribers about self changes.\n\t\t */\n\t\temit( quant = $mol_wire_cursor.stale ) {\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\t;( this[i] as $mol_wire_sub ).absorb( quant )\n\t\t\t}\n\t\t}\n\t\t\n\t\t/**\n\t\t * Moves peer from one position to another. Doesn't clear data at old position!\n\t\t */\n\t\tpeer_move( from_pos: number, to_pos: number ) {\n\t\t\t\n\t\t\tconst peer = this[ from_pos ] as $mol_wire_pub\n\t\t\tconst self_pos = this[ from_pos + 1 ] as number\n\t\t\t\n\t\t\tthis[ to_pos ] = peer\n\t\t\tthis[ to_pos + 1 ] = self_pos\n\t\t\t\n\t\t\tpeer.peer_repos( self_pos, to_pos )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Updates self position in the peer.\n\t\t */\n\t\tpeer_repos( peer_pos: number, self_pos: number ) {\n\t\t\tthis[ peer_pos + 1 ] = self_pos\n\t\t}\n\t\t\n\t}\n\t\n}\n",null,"namespace $ {\n\t\n\tlet auto: $mol_wire_sub | null = null\n\t\n\t/**\n\t * When fulfilled, all publishers are promoted to this subscriber on access to its.\n\t */\n\texport function $mol_wire_auto( next = auto ) {\n\t\treturn auto = next\n\t}\n\t\n\t/**\n\t * Affection queue. Used to prevent accidental stack overflow on emit.\n\t */\n\texport const $mol_wire_affected = [] as ( $mol_wire_sub | number )[]\n\t\n}\n"]}
|
package/node.test.js
CHANGED
|
@@ -82,7 +82,7 @@ var $;
|
|
|
82
82
|
}
|
|
83
83
|
reap() { }
|
|
84
84
|
promote() {
|
|
85
|
-
$mol_wire_auto?.track_next(this);
|
|
85
|
+
$mol_wire_auto()?.track_next(this);
|
|
86
86
|
}
|
|
87
87
|
up() { }
|
|
88
88
|
down() { }
|
|
@@ -92,10 +92,6 @@ var $;
|
|
|
92
92
|
this[i].absorb(quant);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
absorb(quant = $mol_wire_cursor.stale) {
|
|
96
|
-
this.emit($mol_wire_cursor.doubt);
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
95
|
peer_move(from_pos, to_pos) {
|
|
100
96
|
const peer = this[from_pos];
|
|
101
97
|
const self_pos = this[from_pos + 1];
|
|
@@ -117,7 +113,11 @@ var $;
|
|
|
117
113
|
"use strict";
|
|
118
114
|
var $;
|
|
119
115
|
(function ($) {
|
|
120
|
-
|
|
116
|
+
let auto = null;
|
|
117
|
+
function $mol_wire_auto(next = auto) {
|
|
118
|
+
return auto = next;
|
|
119
|
+
}
|
|
120
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
121
121
|
$.$mol_wire_affected = [];
|
|
122
122
|
})($ || ($ = {}));
|
|
123
123
|
//mol/wire/wire.ts
|
|
@@ -2139,8 +2139,8 @@ var $;
|
|
|
2139
2139
|
}
|
|
2140
2140
|
track_on() {
|
|
2141
2141
|
this.cursor = this.pub_from;
|
|
2142
|
-
const sub = $mol_wire_auto;
|
|
2143
|
-
$mol_wire_auto
|
|
2142
|
+
const sub = $mol_wire_auto();
|
|
2143
|
+
$mol_wire_auto(this);
|
|
2144
2144
|
return sub;
|
|
2145
2145
|
}
|
|
2146
2146
|
promote() {
|
|
@@ -2182,7 +2182,7 @@ var $;
|
|
|
2182
2182
|
return pub;
|
|
2183
2183
|
}
|
|
2184
2184
|
track_off(sub) {
|
|
2185
|
-
$mol_wire_auto
|
|
2185
|
+
$mol_wire_auto(sub);
|
|
2186
2186
|
if (this.cursor < 0) {
|
|
2187
2187
|
$mol_fail(new Error('End of non begun sub'));
|
|
2188
2188
|
}
|
|
@@ -2233,11 +2233,11 @@ var $;
|
|
|
2233
2233
|
}
|
|
2234
2234
|
absorb(quant = $mol_wire_cursor.stale) {
|
|
2235
2235
|
if (this.cursor === $mol_wire_cursor.final)
|
|
2236
|
-
return
|
|
2236
|
+
return;
|
|
2237
2237
|
if (this.cursor >= quant)
|
|
2238
|
-
return
|
|
2238
|
+
return;
|
|
2239
2239
|
this.cursor = quant;
|
|
2240
|
-
|
|
2240
|
+
this.emit($mol_wire_cursor.doubt);
|
|
2241
2241
|
}
|
|
2242
2242
|
[$mol_dev_format_head]() {
|
|
2243
2243
|
return $mol_dev_format_native(this);
|
|
@@ -2470,7 +2470,7 @@ var $;
|
|
|
2470
2470
|
host;
|
|
2471
2471
|
task;
|
|
2472
2472
|
static temp(host, task, ...args) {
|
|
2473
|
-
const existen = $mol_wire_auto?.track_next();
|
|
2473
|
+
const existen = $mol_wire_auto()?.track_next();
|
|
2474
2474
|
reuse: if (existen) {
|
|
2475
2475
|
if (!(existen instanceof $mol_wire_fiber))
|
|
2476
2476
|
break reuse;
|
|
@@ -2618,13 +2618,11 @@ var $;
|
|
|
2618
2618
|
get $() {
|
|
2619
2619
|
return (this.host ?? this.task)['$'];
|
|
2620
2620
|
}
|
|
2621
|
-
|
|
2622
|
-
if (
|
|
2623
|
-
return false;
|
|
2624
|
-
if (this.sub_from === this.length) {
|
|
2621
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
2622
|
+
if (this.sub_empty)
|
|
2625
2623
|
this.plan();
|
|
2626
|
-
|
|
2627
|
-
|
|
2624
|
+
else
|
|
2625
|
+
super.emit(quant);
|
|
2628
2626
|
}
|
|
2629
2627
|
down() {
|
|
2630
2628
|
if (this.persist)
|
|
@@ -2870,7 +2868,7 @@ var $;
|
|
|
2870
2868
|
this.watch()?.();
|
|
2871
2869
|
}
|
|
2872
2870
|
finally {
|
|
2873
|
-
for (const pub of $mol_wire_auto.pub_list) {
|
|
2871
|
+
for (const pub of $mol_wire_auto().pub_list) {
|
|
2874
2872
|
if (pub instanceof $mol_wire_fiber) {
|
|
2875
2873
|
this.track(pub);
|
|
2876
2874
|
}
|