mol_wire_lib 1.0.174 → 1.0.175
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.esm.js +11 -10
- package/node.esm.js.map +1 -1
- package/node.js +11 -10
- package/node.js.map +1 -1
- package/node.test.js +11 -10
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +2 -2
- package/web.esm.js +11 -10
- package/web.esm.js.map +1 -1
- package/web.js +11 -10
- package/web.js.map +1 -1
package/node.d.ts
CHANGED
|
@@ -189,7 +189,7 @@ declare namespace $ {
|
|
|
189
189
|
get args(): Args;
|
|
190
190
|
result(): Result | undefined;
|
|
191
191
|
field(): string;
|
|
192
|
-
constructor(id: string, task: (this: Host, ...args: Args) => Result, host?: Host | undefined,
|
|
192
|
+
constructor(id: string, task: (this: Host, ...args: Args) => Result, host?: Host | undefined, args?: Args);
|
|
193
193
|
plan(): void;
|
|
194
194
|
reap(): void;
|
|
195
195
|
toString(): any;
|
|
@@ -239,7 +239,7 @@ declare namespace $ {
|
|
|
239
239
|
declare namespace $ {
|
|
240
240
|
class $mol_wire_atom<Host, Args extends readonly unknown[], Result> extends $mol_wire_fiber<Host, Args, Result> {
|
|
241
241
|
static getter<Host, Args extends readonly unknown[], Result>(task: (this: Host, ...args: Args) => Result, keys: number): (host: Host, args: Args) => $mol_wire_atom<Host, [...Args], Result>;
|
|
242
|
-
resync(
|
|
242
|
+
resync(args: Args): Error | Result | Promise<Error | Result>;
|
|
243
243
|
once(): Awaited<Result>;
|
|
244
244
|
destructor(): void;
|
|
245
245
|
put(next: Result | Error | Promise<Result | Error>): Error | Result | Promise<Error | Result>;
|
package/node.esm.js
CHANGED
|
@@ -616,12 +616,13 @@ var $;
|
|
|
616
616
|
field() {
|
|
617
617
|
return this.task.name + '()';
|
|
618
618
|
}
|
|
619
|
-
constructor(id, task, host,
|
|
619
|
+
constructor(id, task, host, args) {
|
|
620
620
|
super();
|
|
621
621
|
this.task = task;
|
|
622
622
|
this.host = host;
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
if (args)
|
|
624
|
+
this.data.push(...args);
|
|
625
|
+
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
625
626
|
this[Symbol.toStringTag] = id;
|
|
626
627
|
}
|
|
627
628
|
plan() {
|
|
@@ -682,7 +683,7 @@ var $;
|
|
|
682
683
|
result = this.task.call(this.host, this.data[0]);
|
|
683
684
|
break;
|
|
684
685
|
default:
|
|
685
|
-
result = this.task.call(this.host, ...this.
|
|
686
|
+
result = this.task.call(this.host, ...this.args);
|
|
686
687
|
break;
|
|
687
688
|
}
|
|
688
689
|
if (result instanceof Promise) {
|
|
@@ -896,7 +897,7 @@ var $;
|
|
|
896
897
|
break reuse;
|
|
897
898
|
return existen;
|
|
898
899
|
}
|
|
899
|
-
return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host,
|
|
900
|
+
return new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}(#)`, task, host, args);
|
|
900
901
|
};
|
|
901
902
|
}
|
|
902
903
|
complete() {
|
|
@@ -1021,7 +1022,7 @@ var $;
|
|
|
1021
1022
|
else {
|
|
1022
1023
|
dict = (host ?? task)[field] = new Map();
|
|
1023
1024
|
}
|
|
1024
|
-
fiber = new $mol_wire_atom(key, task, host,
|
|
1025
|
+
fiber = new $mol_wire_atom(key, task, host, args);
|
|
1025
1026
|
dict.set(key, fiber);
|
|
1026
1027
|
return fiber;
|
|
1027
1028
|
};
|
|
@@ -1032,13 +1033,13 @@ var $;
|
|
|
1032
1033
|
if (existen)
|
|
1033
1034
|
return existen;
|
|
1034
1035
|
const key = `${host?.[Symbol.toStringTag] ?? host}.${field}`;
|
|
1035
|
-
const fiber = new $mol_wire_atom(key, task, host,
|
|
1036
|
+
const fiber = new $mol_wire_atom(key, task, host, args);
|
|
1036
1037
|
(host ?? task)[field] = fiber;
|
|
1037
1038
|
return fiber;
|
|
1038
1039
|
};
|
|
1039
1040
|
}
|
|
1040
1041
|
}
|
|
1041
|
-
resync(
|
|
1042
|
+
resync(args) {
|
|
1042
1043
|
return this.put(this.task.call(this.host, ...args));
|
|
1043
1044
|
}
|
|
1044
1045
|
once() {
|
|
@@ -1196,7 +1197,7 @@ var $;
|
|
|
1196
1197
|
let atom = persist(this, args.slice(0, keys));
|
|
1197
1198
|
if (args.length <= keys || args[keys] === undefined) {
|
|
1198
1199
|
if (!$mol_wire_fiber.warm)
|
|
1199
|
-
return atom.
|
|
1200
|
+
return atom.result();
|
|
1200
1201
|
if ($mol_wire_auto() instanceof $mol_wire_task) {
|
|
1201
1202
|
return atom.once();
|
|
1202
1203
|
}
|
|
@@ -1204,7 +1205,7 @@ var $;
|
|
|
1204
1205
|
return atom.sync();
|
|
1205
1206
|
}
|
|
1206
1207
|
}
|
|
1207
|
-
return atom.resync(
|
|
1208
|
+
return atom.resync(args);
|
|
1208
1209
|
};
|
|
1209
1210
|
Object.defineProperty(wrapper, 'name', { value: func.name + ' ' });
|
|
1210
1211
|
Object.assign(wrapper, { orig: func });
|