mol_dump_lib 0.0.495 → 0.0.497
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 +52 -52
- package/node.deps.json +1 -1
- package/node.js +16 -21
- package/node.js.map +1 -1
- package/node.mjs +16 -21
- package/node.test.js +201 -206
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +52 -52
- package/web.deps.json +1 -1
package/node.mjs
CHANGED
|
@@ -1991,27 +1991,19 @@ var $node = new Proxy({ require }, {
|
|
|
1991
1991
|
return target.require(name);
|
|
1992
1992
|
if (name[0] === '.')
|
|
1993
1993
|
return target.require(name);
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
2003
|
-
try {
|
|
2004
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
2005
|
-
}
|
|
2006
|
-
catch (e) {
|
|
2007
|
-
if ($$.$mol_fail_catch(e)) {
|
|
2008
|
-
$$.$mol_fail_log(e);
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
break;
|
|
1994
|
+
try {
|
|
1995
|
+
target.require.resolve(name);
|
|
1996
|
+
}
|
|
1997
|
+
catch {
|
|
1998
|
+
const $$ = $;
|
|
1999
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
2000
|
+
try {
|
|
2001
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
2012
2002
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2003
|
+
catch (e) {
|
|
2004
|
+
if ($$.$mol_fail_catch(e)) {
|
|
2005
|
+
$$.$mol_fail_log(e);
|
|
2006
|
+
}
|
|
2015
2007
|
}
|
|
2016
2008
|
}
|
|
2017
2009
|
try {
|
|
@@ -2145,7 +2137,10 @@ var $;
|
|
|
2145
2137
|
command: args_raw.join(' '),
|
|
2146
2138
|
dir: $node.path.relative('', dir),
|
|
2147
2139
|
});
|
|
2148
|
-
|
|
2140
|
+
const res = this.$mol_run_spawn_sync(app, args, { shell: true, cwd: dir, env });
|
|
2141
|
+
if (res.status)
|
|
2142
|
+
$mol_fail(new Error(res.stderr.toString() || 'Exit(' + res.status + ')'));
|
|
2143
|
+
return res;
|
|
2149
2144
|
}
|
|
2150
2145
|
const sub = this.$mol_run_spawn(app, args, {
|
|
2151
2146
|
shell: true,
|
package/node.test.js
CHANGED
|
@@ -1982,27 +1982,19 @@ var $node = new Proxy({ require }, {
|
|
|
1982
1982
|
return target.require(name);
|
|
1983
1983
|
if (name[0] === '.')
|
|
1984
1984
|
return target.require(name);
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1994
|
-
try {
|
|
1995
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1996
|
-
}
|
|
1997
|
-
catch (e) {
|
|
1998
|
-
if ($$.$mol_fail_catch(e)) {
|
|
1999
|
-
$$.$mol_fail_log(e);
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
break;
|
|
1985
|
+
try {
|
|
1986
|
+
target.require.resolve(name);
|
|
1987
|
+
}
|
|
1988
|
+
catch {
|
|
1989
|
+
const $$ = $;
|
|
1990
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1991
|
+
try {
|
|
1992
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
2003
1993
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
1994
|
+
catch (e) {
|
|
1995
|
+
if ($$.$mol_fail_catch(e)) {
|
|
1996
|
+
$$.$mol_fail_log(e);
|
|
1997
|
+
}
|
|
2006
1998
|
}
|
|
2007
1999
|
}
|
|
2008
2000
|
try {
|
|
@@ -2136,7 +2128,10 @@ var $;
|
|
|
2136
2128
|
command: args_raw.join(' '),
|
|
2137
2129
|
dir: $node.path.relative('', dir),
|
|
2138
2130
|
});
|
|
2139
|
-
|
|
2131
|
+
const res = this.$mol_run_spawn_sync(app, args, { shell: true, cwd: dir, env });
|
|
2132
|
+
if (res.status)
|
|
2133
|
+
$mol_fail(new Error(res.stderr.toString() || 'Exit(' + res.status + ')'));
|
|
2134
|
+
return res;
|
|
2140
2135
|
}
|
|
2141
2136
|
const sub = this.$mol_run_spawn(app, args, {
|
|
2142
2137
|
shell: true,
|
|
@@ -6701,14 +6696,156 @@ var $;
|
|
|
6701
6696
|
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
6702
6697
|
})($ || ($ = {}));
|
|
6703
6698
|
|
|
6699
|
+
;
|
|
6700
|
+
"use strict";
|
|
6701
|
+
var $;
|
|
6702
|
+
(function ($_1) {
|
|
6703
|
+
$mol_test({
|
|
6704
|
+
'FQN of anon function'($) {
|
|
6705
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
6706
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
6707
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
6708
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
6709
|
+
},
|
|
6710
|
+
});
|
|
6711
|
+
})($ || ($ = {}));
|
|
6712
|
+
|
|
6713
|
+
;
|
|
6714
|
+
"use strict";
|
|
6715
|
+
var $;
|
|
6716
|
+
(function ($) {
|
|
6717
|
+
$mol_test({
|
|
6718
|
+
'auto name'() {
|
|
6719
|
+
class Invalid extends $mol_error_mix {
|
|
6720
|
+
}
|
|
6721
|
+
const mix = new Invalid('foo');
|
|
6722
|
+
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
6723
|
+
},
|
|
6724
|
+
'simpe mix'() {
|
|
6725
|
+
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
6726
|
+
$mol_assert_equal(mix.message, 'foo');
|
|
6727
|
+
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
6728
|
+
},
|
|
6729
|
+
'provide additional info'() {
|
|
6730
|
+
class Invalid extends $mol_error_mix {
|
|
6731
|
+
}
|
|
6732
|
+
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
|
|
6733
|
+
const hints = [];
|
|
6734
|
+
if (mix instanceof $mol_error_mix) {
|
|
6735
|
+
for (const er of mix.errors) {
|
|
6736
|
+
if (er instanceof Invalid) {
|
|
6737
|
+
hints.push(er.cause?.hint ?? '');
|
|
6738
|
+
}
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
6742
|
+
},
|
|
6743
|
+
});
|
|
6744
|
+
})($ || ($ = {}));
|
|
6745
|
+
|
|
6746
|
+
;
|
|
6747
|
+
"use strict";
|
|
6748
|
+
var $;
|
|
6749
|
+
(function ($_1) {
|
|
6750
|
+
$mol_test_mocks.push($ => {
|
|
6751
|
+
$.$mol_log3_come = () => { };
|
|
6752
|
+
$.$mol_log3_done = () => { };
|
|
6753
|
+
$.$mol_log3_fail = () => { };
|
|
6754
|
+
$.$mol_log3_warn = () => { };
|
|
6755
|
+
$.$mol_log3_rise = () => { };
|
|
6756
|
+
$.$mol_log3_area = () => () => { };
|
|
6757
|
+
});
|
|
6758
|
+
})($ || ($ = {}));
|
|
6759
|
+
|
|
6760
|
+
;
|
|
6761
|
+
"use strict";
|
|
6762
|
+
|
|
6763
|
+
;
|
|
6764
|
+
"use strict";
|
|
6765
|
+
|
|
6704
6766
|
;
|
|
6705
6767
|
"use strict";
|
|
6706
6768
|
|
|
6707
6769
|
;
|
|
6708
6770
|
"use strict";
|
|
6771
|
+
var $;
|
|
6772
|
+
(function ($_1) {
|
|
6773
|
+
$mol_test({
|
|
6774
|
+
'test types'($) {
|
|
6775
|
+
class A {
|
|
6776
|
+
static a() {
|
|
6777
|
+
return Promise.resolve('');
|
|
6778
|
+
}
|
|
6779
|
+
static b() {
|
|
6780
|
+
return $mol_wire_sync(this).a();
|
|
6781
|
+
}
|
|
6782
|
+
}
|
|
6783
|
+
},
|
|
6784
|
+
async 'test method from host'($) {
|
|
6785
|
+
let count = 0;
|
|
6786
|
+
class A {
|
|
6787
|
+
static a() {
|
|
6788
|
+
return $mol_wire_sync(this).b();
|
|
6789
|
+
}
|
|
6790
|
+
static b() { return Promise.resolve(++count); }
|
|
6791
|
+
}
|
|
6792
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
6793
|
+
},
|
|
6794
|
+
async 'test function'($) {
|
|
6795
|
+
let count = 0;
|
|
6796
|
+
class A {
|
|
6797
|
+
static a() {
|
|
6798
|
+
return $mol_wire_sync(this.b)();
|
|
6799
|
+
}
|
|
6800
|
+
static b() { return Promise.resolve(++count); }
|
|
6801
|
+
}
|
|
6802
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
6803
|
+
},
|
|
6804
|
+
async 'test construct itself'($) {
|
|
6805
|
+
class A {
|
|
6806
|
+
static instances = [];
|
|
6807
|
+
static a() {
|
|
6808
|
+
const a = new ($mol_wire_sync(A))();
|
|
6809
|
+
this.instances.push(a);
|
|
6810
|
+
$mol_wire_sync(this).b();
|
|
6811
|
+
}
|
|
6812
|
+
static b() { return Promise.resolve(); }
|
|
6813
|
+
}
|
|
6814
|
+
await $mol_wire_async(A).a();
|
|
6815
|
+
$mol_assert_equal(A.instances.length, 2);
|
|
6816
|
+
$mol_assert_equal(A.instances[0] instanceof A);
|
|
6817
|
+
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
6818
|
+
}
|
|
6819
|
+
});
|
|
6820
|
+
})($ || ($ = {}));
|
|
6709
6821
|
|
|
6710
6822
|
;
|
|
6711
6823
|
"use strict";
|
|
6824
|
+
var $;
|
|
6825
|
+
(function ($_1) {
|
|
6826
|
+
$mol_test({
|
|
6827
|
+
async 'exec timeout auto kill child process'($) {
|
|
6828
|
+
let close_mock = () => { };
|
|
6829
|
+
const context_mock = $.$mol_ambient({
|
|
6830
|
+
$mol_run_spawn: () => ({
|
|
6831
|
+
on(name, cb) {
|
|
6832
|
+
if (name === 'exit')
|
|
6833
|
+
close_mock = cb;
|
|
6834
|
+
},
|
|
6835
|
+
kill() { close_mock(); }
|
|
6836
|
+
})
|
|
6837
|
+
});
|
|
6838
|
+
let message = '';
|
|
6839
|
+
try {
|
|
6840
|
+
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10, env: { 'MOL_RUN_ASYNC': '1' } });
|
|
6841
|
+
}
|
|
6842
|
+
catch (e) {
|
|
6843
|
+
message = e.message;
|
|
6844
|
+
}
|
|
6845
|
+
$mol_assert_equal(message, 'Run error, timeout');
|
|
6846
|
+
}
|
|
6847
|
+
});
|
|
6848
|
+
})($ || ($ = {}));
|
|
6712
6849
|
|
|
6713
6850
|
;
|
|
6714
6851
|
"use strict";
|
|
@@ -7463,34 +7600,6 @@ var $;
|
|
|
7463
7600
|
});
|
|
7464
7601
|
})($ || ($ = {}));
|
|
7465
7602
|
|
|
7466
|
-
;
|
|
7467
|
-
"use strict";
|
|
7468
|
-
var $;
|
|
7469
|
-
(function ($_1) {
|
|
7470
|
-
$mol_test_mocks.push($ => {
|
|
7471
|
-
$.$mol_log3_come = () => { };
|
|
7472
|
-
$.$mol_log3_done = () => { };
|
|
7473
|
-
$.$mol_log3_fail = () => { };
|
|
7474
|
-
$.$mol_log3_warn = () => { };
|
|
7475
|
-
$.$mol_log3_rise = () => { };
|
|
7476
|
-
$.$mol_log3_area = () => () => { };
|
|
7477
|
-
});
|
|
7478
|
-
})($ || ($ = {}));
|
|
7479
|
-
|
|
7480
|
-
;
|
|
7481
|
-
"use strict";
|
|
7482
|
-
var $;
|
|
7483
|
-
(function ($_1) {
|
|
7484
|
-
$mol_test({
|
|
7485
|
-
'FQN of anon function'($) {
|
|
7486
|
-
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
7487
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
7488
|
-
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
7489
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
7490
|
-
},
|
|
7491
|
-
});
|
|
7492
|
-
})($ || ($ = {}));
|
|
7493
|
-
|
|
7494
7603
|
;
|
|
7495
7604
|
"use strict";
|
|
7496
7605
|
var $;
|
|
@@ -7738,39 +7847,6 @@ var $;
|
|
|
7738
7847
|
});
|
|
7739
7848
|
})($ || ($ = {}));
|
|
7740
7849
|
|
|
7741
|
-
;
|
|
7742
|
-
"use strict";
|
|
7743
|
-
var $;
|
|
7744
|
-
(function ($) {
|
|
7745
|
-
$mol_test({
|
|
7746
|
-
'auto name'() {
|
|
7747
|
-
class Invalid extends $mol_error_mix {
|
|
7748
|
-
}
|
|
7749
|
-
const mix = new Invalid('foo');
|
|
7750
|
-
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
7751
|
-
},
|
|
7752
|
-
'simpe mix'() {
|
|
7753
|
-
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
7754
|
-
$mol_assert_equal(mix.message, 'foo');
|
|
7755
|
-
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
7756
|
-
},
|
|
7757
|
-
'provide additional info'() {
|
|
7758
|
-
class Invalid extends $mol_error_mix {
|
|
7759
|
-
}
|
|
7760
|
-
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
|
|
7761
|
-
const hints = [];
|
|
7762
|
-
if (mix instanceof $mol_error_mix) {
|
|
7763
|
-
for (const er of mix.errors) {
|
|
7764
|
-
if (er instanceof Invalid) {
|
|
7765
|
-
hints.push(er.cause?.hint ?? '');
|
|
7766
|
-
}
|
|
7767
|
-
}
|
|
7768
|
-
}
|
|
7769
|
-
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
7770
|
-
},
|
|
7771
|
-
});
|
|
7772
|
-
})($ || ($ = {}));
|
|
7773
|
-
|
|
7774
7850
|
;
|
|
7775
7851
|
"use strict";
|
|
7776
7852
|
var $;
|
|
@@ -7958,112 +8034,6 @@ var $;
|
|
|
7958
8034
|
});
|
|
7959
8035
|
})($ || ($ = {}));
|
|
7960
8036
|
|
|
7961
|
-
;
|
|
7962
|
-
"use strict";
|
|
7963
|
-
var $;
|
|
7964
|
-
(function ($_1) {
|
|
7965
|
-
$mol_test({
|
|
7966
|
-
'test types'($) {
|
|
7967
|
-
class A {
|
|
7968
|
-
static a() {
|
|
7969
|
-
return '';
|
|
7970
|
-
}
|
|
7971
|
-
static b() {
|
|
7972
|
-
return $mol_wire_async(this).a();
|
|
7973
|
-
}
|
|
7974
|
-
}
|
|
7975
|
-
},
|
|
7976
|
-
async 'Latest method calls wins'($) {
|
|
7977
|
-
class NameLogger extends $mol_object2 {
|
|
7978
|
-
static $ = $;
|
|
7979
|
-
static first = [];
|
|
7980
|
-
static last = [];
|
|
7981
|
-
static send(next) {
|
|
7982
|
-
$mol_wire_sync(this.first).push(next);
|
|
7983
|
-
this.$.$mol_wait_timeout(0);
|
|
7984
|
-
this.last.push(next);
|
|
7985
|
-
}
|
|
7986
|
-
}
|
|
7987
|
-
const name = $mol_wire_async(NameLogger).send;
|
|
7988
|
-
name('john');
|
|
7989
|
-
const promise = name('jin');
|
|
7990
|
-
$.$mol_after_mock_warp();
|
|
7991
|
-
await promise;
|
|
7992
|
-
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
7993
|
-
$mol_assert_like(NameLogger.last, ['jin']);
|
|
7994
|
-
},
|
|
7995
|
-
async 'Latest function calls wins'($) {
|
|
7996
|
-
const first = [];
|
|
7997
|
-
const last = [];
|
|
7998
|
-
function send_name(next) {
|
|
7999
|
-
$mol_wire_sync(first).push(next);
|
|
8000
|
-
$.$mol_wait_timeout(0);
|
|
8001
|
-
last.push(next);
|
|
8002
|
-
}
|
|
8003
|
-
const name = $mol_wire_async(send_name);
|
|
8004
|
-
name('john');
|
|
8005
|
-
const promise = name('jin');
|
|
8006
|
-
$.$mol_after_mock_warp();
|
|
8007
|
-
await promise;
|
|
8008
|
-
$mol_assert_like(first, ['john', 'jin']);
|
|
8009
|
-
$mol_assert_like(last, ['jin']);
|
|
8010
|
-
},
|
|
8011
|
-
});
|
|
8012
|
-
})($ || ($ = {}));
|
|
8013
|
-
|
|
8014
|
-
;
|
|
8015
|
-
"use strict";
|
|
8016
|
-
var $;
|
|
8017
|
-
(function ($_1) {
|
|
8018
|
-
$mol_test({
|
|
8019
|
-
'test types'($) {
|
|
8020
|
-
class A {
|
|
8021
|
-
static a() {
|
|
8022
|
-
return Promise.resolve('');
|
|
8023
|
-
}
|
|
8024
|
-
static b() {
|
|
8025
|
-
return $mol_wire_sync(this).a();
|
|
8026
|
-
}
|
|
8027
|
-
}
|
|
8028
|
-
},
|
|
8029
|
-
async 'test method from host'($) {
|
|
8030
|
-
let count = 0;
|
|
8031
|
-
class A {
|
|
8032
|
-
static a() {
|
|
8033
|
-
return $mol_wire_sync(this).b();
|
|
8034
|
-
}
|
|
8035
|
-
static b() { return Promise.resolve(++count); }
|
|
8036
|
-
}
|
|
8037
|
-
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
8038
|
-
},
|
|
8039
|
-
async 'test function'($) {
|
|
8040
|
-
let count = 0;
|
|
8041
|
-
class A {
|
|
8042
|
-
static a() {
|
|
8043
|
-
return $mol_wire_sync(this.b)();
|
|
8044
|
-
}
|
|
8045
|
-
static b() { return Promise.resolve(++count); }
|
|
8046
|
-
}
|
|
8047
|
-
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
8048
|
-
},
|
|
8049
|
-
async 'test construct itself'($) {
|
|
8050
|
-
class A {
|
|
8051
|
-
static instances = [];
|
|
8052
|
-
static a() {
|
|
8053
|
-
const a = new ($mol_wire_sync(A))();
|
|
8054
|
-
this.instances.push(a);
|
|
8055
|
-
$mol_wire_sync(this).b();
|
|
8056
|
-
}
|
|
8057
|
-
static b() { return Promise.resolve(); }
|
|
8058
|
-
}
|
|
8059
|
-
await $mol_wire_async(A).a();
|
|
8060
|
-
$mol_assert_equal(A.instances.length, 2);
|
|
8061
|
-
$mol_assert_equal(A.instances[0] instanceof A);
|
|
8062
|
-
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
8063
|
-
}
|
|
8064
|
-
});
|
|
8065
|
-
})($ || ($ = {}));
|
|
8066
|
-
|
|
8067
8037
|
;
|
|
8068
8038
|
"use strict";
|
|
8069
8039
|
var $;
|
|
@@ -8115,26 +8085,51 @@ var $;
|
|
|
8115
8085
|
var $;
|
|
8116
8086
|
(function ($_1) {
|
|
8117
8087
|
$mol_test({
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
kill() { close_mock(); }
|
|
8127
|
-
})
|
|
8128
|
-
});
|
|
8129
|
-
let message = '';
|
|
8130
|
-
try {
|
|
8131
|
-
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10, env: { 'MOL_RUN_ASYNC': '1' } });
|
|
8088
|
+
'test types'($) {
|
|
8089
|
+
class A {
|
|
8090
|
+
static a() {
|
|
8091
|
+
return '';
|
|
8092
|
+
}
|
|
8093
|
+
static b() {
|
|
8094
|
+
return $mol_wire_async(this).a();
|
|
8095
|
+
}
|
|
8132
8096
|
}
|
|
8133
|
-
|
|
8134
|
-
|
|
8097
|
+
},
|
|
8098
|
+
async 'Latest method calls wins'($) {
|
|
8099
|
+
class NameLogger extends $mol_object2 {
|
|
8100
|
+
static $ = $;
|
|
8101
|
+
static first = [];
|
|
8102
|
+
static last = [];
|
|
8103
|
+
static send(next) {
|
|
8104
|
+
$mol_wire_sync(this.first).push(next);
|
|
8105
|
+
this.$.$mol_wait_timeout(0);
|
|
8106
|
+
this.last.push(next);
|
|
8107
|
+
}
|
|
8135
8108
|
}
|
|
8136
|
-
|
|
8137
|
-
|
|
8109
|
+
const name = $mol_wire_async(NameLogger).send;
|
|
8110
|
+
name('john');
|
|
8111
|
+
const promise = name('jin');
|
|
8112
|
+
$.$mol_after_mock_warp();
|
|
8113
|
+
await promise;
|
|
8114
|
+
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
8115
|
+
$mol_assert_like(NameLogger.last, ['jin']);
|
|
8116
|
+
},
|
|
8117
|
+
async 'Latest function calls wins'($) {
|
|
8118
|
+
const first = [];
|
|
8119
|
+
const last = [];
|
|
8120
|
+
function send_name(next) {
|
|
8121
|
+
$mol_wire_sync(first).push(next);
|
|
8122
|
+
$.$mol_wait_timeout(0);
|
|
8123
|
+
last.push(next);
|
|
8124
|
+
}
|
|
8125
|
+
const name = $mol_wire_async(send_name);
|
|
8126
|
+
name('john');
|
|
8127
|
+
const promise = name('jin');
|
|
8128
|
+
$.$mol_after_mock_warp();
|
|
8129
|
+
await promise;
|
|
8130
|
+
$mol_assert_like(first, ['john', 'jin']);
|
|
8131
|
+
$mol_assert_like(last, ['jin']);
|
|
8132
|
+
},
|
|
8138
8133
|
});
|
|
8139
8134
|
})($ || ($ = {}));
|
|
8140
8135
|
|