mol_plot_all 1.2.1176 → 1.2.1178
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 +90 -90
- 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 +90 -90
- 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,
|
|
@@ -6304,6 +6299,73 @@ var $;
|
|
|
6304
6299
|
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
6305
6300
|
})($ || ($ = {}));
|
|
6306
6301
|
|
|
6302
|
+
;
|
|
6303
|
+
"use strict";
|
|
6304
|
+
var $;
|
|
6305
|
+
(function ($_1) {
|
|
6306
|
+
$mol_test({
|
|
6307
|
+
'FQN of anon function'($) {
|
|
6308
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
6309
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
6310
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
6311
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
6312
|
+
},
|
|
6313
|
+
});
|
|
6314
|
+
})($ || ($ = {}));
|
|
6315
|
+
|
|
6316
|
+
;
|
|
6317
|
+
"use strict";
|
|
6318
|
+
var $;
|
|
6319
|
+
(function ($) {
|
|
6320
|
+
$mol_test({
|
|
6321
|
+
'auto name'() {
|
|
6322
|
+
class Invalid extends $mol_error_mix {
|
|
6323
|
+
}
|
|
6324
|
+
const mix = new Invalid('foo');
|
|
6325
|
+
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
6326
|
+
},
|
|
6327
|
+
'simpe mix'() {
|
|
6328
|
+
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
6329
|
+
$mol_assert_equal(mix.message, 'foo');
|
|
6330
|
+
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
6331
|
+
},
|
|
6332
|
+
'provide additional info'() {
|
|
6333
|
+
class Invalid extends $mol_error_mix {
|
|
6334
|
+
}
|
|
6335
|
+
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' }));
|
|
6336
|
+
const hints = [];
|
|
6337
|
+
if (mix instanceof $mol_error_mix) {
|
|
6338
|
+
for (const er of mix.errors) {
|
|
6339
|
+
if (er instanceof Invalid) {
|
|
6340
|
+
hints.push(er.cause?.hint ?? '');
|
|
6341
|
+
}
|
|
6342
|
+
}
|
|
6343
|
+
}
|
|
6344
|
+
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
6345
|
+
},
|
|
6346
|
+
});
|
|
6347
|
+
})($ || ($ = {}));
|
|
6348
|
+
|
|
6349
|
+
;
|
|
6350
|
+
"use strict";
|
|
6351
|
+
var $;
|
|
6352
|
+
(function ($_1) {
|
|
6353
|
+
$mol_test_mocks.push($ => {
|
|
6354
|
+
$.$mol_log3_come = () => { };
|
|
6355
|
+
$.$mol_log3_done = () => { };
|
|
6356
|
+
$.$mol_log3_fail = () => { };
|
|
6357
|
+
$.$mol_log3_warn = () => { };
|
|
6358
|
+
$.$mol_log3_rise = () => { };
|
|
6359
|
+
$.$mol_log3_area = () => () => { };
|
|
6360
|
+
});
|
|
6361
|
+
})($ || ($ = {}));
|
|
6362
|
+
|
|
6363
|
+
;
|
|
6364
|
+
"use strict";
|
|
6365
|
+
|
|
6366
|
+
;
|
|
6367
|
+
"use strict";
|
|
6368
|
+
|
|
6307
6369
|
;
|
|
6308
6370
|
"use strict";
|
|
6309
6371
|
|
|
@@ -6315,9 +6377,84 @@ var $;
|
|
|
6315
6377
|
|
|
6316
6378
|
;
|
|
6317
6379
|
"use strict";
|
|
6380
|
+
var $;
|
|
6381
|
+
(function ($_1) {
|
|
6382
|
+
$mol_test({
|
|
6383
|
+
'test types'($) {
|
|
6384
|
+
class A {
|
|
6385
|
+
static a() {
|
|
6386
|
+
return Promise.resolve('');
|
|
6387
|
+
}
|
|
6388
|
+
static b() {
|
|
6389
|
+
return $mol_wire_sync(this).a();
|
|
6390
|
+
}
|
|
6391
|
+
}
|
|
6392
|
+
},
|
|
6393
|
+
async 'test method from host'($) {
|
|
6394
|
+
let count = 0;
|
|
6395
|
+
class A {
|
|
6396
|
+
static a() {
|
|
6397
|
+
return $mol_wire_sync(this).b();
|
|
6398
|
+
}
|
|
6399
|
+
static b() { return Promise.resolve(++count); }
|
|
6400
|
+
}
|
|
6401
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
6402
|
+
},
|
|
6403
|
+
async 'test function'($) {
|
|
6404
|
+
let count = 0;
|
|
6405
|
+
class A {
|
|
6406
|
+
static a() {
|
|
6407
|
+
return $mol_wire_sync(this.b)();
|
|
6408
|
+
}
|
|
6409
|
+
static b() { return Promise.resolve(++count); }
|
|
6410
|
+
}
|
|
6411
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
6412
|
+
},
|
|
6413
|
+
async 'test construct itself'($) {
|
|
6414
|
+
class A {
|
|
6415
|
+
static instances = [];
|
|
6416
|
+
static a() {
|
|
6417
|
+
const a = new ($mol_wire_sync(A))();
|
|
6418
|
+
this.instances.push(a);
|
|
6419
|
+
$mol_wire_sync(this).b();
|
|
6420
|
+
}
|
|
6421
|
+
static b() { return Promise.resolve(); }
|
|
6422
|
+
}
|
|
6423
|
+
await $mol_wire_async(A).a();
|
|
6424
|
+
$mol_assert_equal(A.instances.length, 2);
|
|
6425
|
+
$mol_assert_equal(A.instances[0] instanceof A);
|
|
6426
|
+
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
6427
|
+
}
|
|
6428
|
+
});
|
|
6429
|
+
})($ || ($ = {}));
|
|
6318
6430
|
|
|
6319
6431
|
;
|
|
6320
6432
|
"use strict";
|
|
6433
|
+
var $;
|
|
6434
|
+
(function ($_1) {
|
|
6435
|
+
$mol_test({
|
|
6436
|
+
async 'exec timeout auto kill child process'($) {
|
|
6437
|
+
let close_mock = () => { };
|
|
6438
|
+
const context_mock = $.$mol_ambient({
|
|
6439
|
+
$mol_run_spawn: () => ({
|
|
6440
|
+
on(name, cb) {
|
|
6441
|
+
if (name === 'exit')
|
|
6442
|
+
close_mock = cb;
|
|
6443
|
+
},
|
|
6444
|
+
kill() { close_mock(); }
|
|
6445
|
+
})
|
|
6446
|
+
});
|
|
6447
|
+
let message = '';
|
|
6448
|
+
try {
|
|
6449
|
+
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10, env: { 'MOL_RUN_ASYNC': '1' } });
|
|
6450
|
+
}
|
|
6451
|
+
catch (e) {
|
|
6452
|
+
message = e.message;
|
|
6453
|
+
}
|
|
6454
|
+
$mol_assert_equal(message, 'Run error, timeout');
|
|
6455
|
+
}
|
|
6456
|
+
});
|
|
6457
|
+
})($ || ($ = {}));
|
|
6321
6458
|
|
|
6322
6459
|
;
|
|
6323
6460
|
"use strict";
|
|
@@ -7072,34 +7209,6 @@ var $;
|
|
|
7072
7209
|
});
|
|
7073
7210
|
})($ || ($ = {}));
|
|
7074
7211
|
|
|
7075
|
-
;
|
|
7076
|
-
"use strict";
|
|
7077
|
-
var $;
|
|
7078
|
-
(function ($_1) {
|
|
7079
|
-
$mol_test_mocks.push($ => {
|
|
7080
|
-
$.$mol_log3_come = () => { };
|
|
7081
|
-
$.$mol_log3_done = () => { };
|
|
7082
|
-
$.$mol_log3_fail = () => { };
|
|
7083
|
-
$.$mol_log3_warn = () => { };
|
|
7084
|
-
$.$mol_log3_rise = () => { };
|
|
7085
|
-
$.$mol_log3_area = () => () => { };
|
|
7086
|
-
});
|
|
7087
|
-
})($ || ($ = {}));
|
|
7088
|
-
|
|
7089
|
-
;
|
|
7090
|
-
"use strict";
|
|
7091
|
-
var $;
|
|
7092
|
-
(function ($_1) {
|
|
7093
|
-
$mol_test({
|
|
7094
|
-
'FQN of anon function'($) {
|
|
7095
|
-
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
7096
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
7097
|
-
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
7098
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
7099
|
-
},
|
|
7100
|
-
});
|
|
7101
|
-
})($ || ($ = {}));
|
|
7102
|
-
|
|
7103
7212
|
;
|
|
7104
7213
|
"use strict";
|
|
7105
7214
|
var $;
|
|
@@ -7347,39 +7456,6 @@ var $;
|
|
|
7347
7456
|
});
|
|
7348
7457
|
})($ || ($ = {}));
|
|
7349
7458
|
|
|
7350
|
-
;
|
|
7351
|
-
"use strict";
|
|
7352
|
-
var $;
|
|
7353
|
-
(function ($) {
|
|
7354
|
-
$mol_test({
|
|
7355
|
-
'auto name'() {
|
|
7356
|
-
class Invalid extends $mol_error_mix {
|
|
7357
|
-
}
|
|
7358
|
-
const mix = new Invalid('foo');
|
|
7359
|
-
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
7360
|
-
},
|
|
7361
|
-
'simpe mix'() {
|
|
7362
|
-
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
7363
|
-
$mol_assert_equal(mix.message, 'foo');
|
|
7364
|
-
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
7365
|
-
},
|
|
7366
|
-
'provide additional info'() {
|
|
7367
|
-
class Invalid extends $mol_error_mix {
|
|
7368
|
-
}
|
|
7369
|
-
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' }));
|
|
7370
|
-
const hints = [];
|
|
7371
|
-
if (mix instanceof $mol_error_mix) {
|
|
7372
|
-
for (const er of mix.errors) {
|
|
7373
|
-
if (er instanceof Invalid) {
|
|
7374
|
-
hints.push(er.cause?.hint ?? '');
|
|
7375
|
-
}
|
|
7376
|
-
}
|
|
7377
|
-
}
|
|
7378
|
-
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
7379
|
-
},
|
|
7380
|
-
});
|
|
7381
|
-
})($ || ($ = {}));
|
|
7382
|
-
|
|
7383
7459
|
;
|
|
7384
7460
|
"use strict";
|
|
7385
7461
|
var $;
|
|
@@ -7567,112 +7643,6 @@ var $;
|
|
|
7567
7643
|
});
|
|
7568
7644
|
})($ || ($ = {}));
|
|
7569
7645
|
|
|
7570
|
-
;
|
|
7571
|
-
"use strict";
|
|
7572
|
-
var $;
|
|
7573
|
-
(function ($_1) {
|
|
7574
|
-
$mol_test({
|
|
7575
|
-
'test types'($) {
|
|
7576
|
-
class A {
|
|
7577
|
-
static a() {
|
|
7578
|
-
return '';
|
|
7579
|
-
}
|
|
7580
|
-
static b() {
|
|
7581
|
-
return $mol_wire_async(this).a();
|
|
7582
|
-
}
|
|
7583
|
-
}
|
|
7584
|
-
},
|
|
7585
|
-
async 'Latest method calls wins'($) {
|
|
7586
|
-
class NameLogger extends $mol_object2 {
|
|
7587
|
-
static $ = $;
|
|
7588
|
-
static first = [];
|
|
7589
|
-
static last = [];
|
|
7590
|
-
static send(next) {
|
|
7591
|
-
$mol_wire_sync(this.first).push(next);
|
|
7592
|
-
this.$.$mol_wait_timeout(0);
|
|
7593
|
-
this.last.push(next);
|
|
7594
|
-
}
|
|
7595
|
-
}
|
|
7596
|
-
const name = $mol_wire_async(NameLogger).send;
|
|
7597
|
-
name('john');
|
|
7598
|
-
const promise = name('jin');
|
|
7599
|
-
$.$mol_after_mock_warp();
|
|
7600
|
-
await promise;
|
|
7601
|
-
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
7602
|
-
$mol_assert_like(NameLogger.last, ['jin']);
|
|
7603
|
-
},
|
|
7604
|
-
async 'Latest function calls wins'($) {
|
|
7605
|
-
const first = [];
|
|
7606
|
-
const last = [];
|
|
7607
|
-
function send_name(next) {
|
|
7608
|
-
$mol_wire_sync(first).push(next);
|
|
7609
|
-
$.$mol_wait_timeout(0);
|
|
7610
|
-
last.push(next);
|
|
7611
|
-
}
|
|
7612
|
-
const name = $mol_wire_async(send_name);
|
|
7613
|
-
name('john');
|
|
7614
|
-
const promise = name('jin');
|
|
7615
|
-
$.$mol_after_mock_warp();
|
|
7616
|
-
await promise;
|
|
7617
|
-
$mol_assert_like(first, ['john', 'jin']);
|
|
7618
|
-
$mol_assert_like(last, ['jin']);
|
|
7619
|
-
},
|
|
7620
|
-
});
|
|
7621
|
-
})($ || ($ = {}));
|
|
7622
|
-
|
|
7623
|
-
;
|
|
7624
|
-
"use strict";
|
|
7625
|
-
var $;
|
|
7626
|
-
(function ($_1) {
|
|
7627
|
-
$mol_test({
|
|
7628
|
-
'test types'($) {
|
|
7629
|
-
class A {
|
|
7630
|
-
static a() {
|
|
7631
|
-
return Promise.resolve('');
|
|
7632
|
-
}
|
|
7633
|
-
static b() {
|
|
7634
|
-
return $mol_wire_sync(this).a();
|
|
7635
|
-
}
|
|
7636
|
-
}
|
|
7637
|
-
},
|
|
7638
|
-
async 'test method from host'($) {
|
|
7639
|
-
let count = 0;
|
|
7640
|
-
class A {
|
|
7641
|
-
static a() {
|
|
7642
|
-
return $mol_wire_sync(this).b();
|
|
7643
|
-
}
|
|
7644
|
-
static b() { return Promise.resolve(++count); }
|
|
7645
|
-
}
|
|
7646
|
-
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
7647
|
-
},
|
|
7648
|
-
async 'test function'($) {
|
|
7649
|
-
let count = 0;
|
|
7650
|
-
class A {
|
|
7651
|
-
static a() {
|
|
7652
|
-
return $mol_wire_sync(this.b)();
|
|
7653
|
-
}
|
|
7654
|
-
static b() { return Promise.resolve(++count); }
|
|
7655
|
-
}
|
|
7656
|
-
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
7657
|
-
},
|
|
7658
|
-
async 'test construct itself'($) {
|
|
7659
|
-
class A {
|
|
7660
|
-
static instances = [];
|
|
7661
|
-
static a() {
|
|
7662
|
-
const a = new ($mol_wire_sync(A))();
|
|
7663
|
-
this.instances.push(a);
|
|
7664
|
-
$mol_wire_sync(this).b();
|
|
7665
|
-
}
|
|
7666
|
-
static b() { return Promise.resolve(); }
|
|
7667
|
-
}
|
|
7668
|
-
await $mol_wire_async(A).a();
|
|
7669
|
-
$mol_assert_equal(A.instances.length, 2);
|
|
7670
|
-
$mol_assert_equal(A.instances[0] instanceof A);
|
|
7671
|
-
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
7672
|
-
}
|
|
7673
|
-
});
|
|
7674
|
-
})($ || ($ = {}));
|
|
7675
|
-
|
|
7676
7646
|
;
|
|
7677
7647
|
"use strict";
|
|
7678
7648
|
var $;
|
|
@@ -7724,26 +7694,51 @@ var $;
|
|
|
7724
7694
|
var $;
|
|
7725
7695
|
(function ($_1) {
|
|
7726
7696
|
$mol_test({
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
kill() { close_mock(); }
|
|
7736
|
-
})
|
|
7737
|
-
});
|
|
7738
|
-
let message = '';
|
|
7739
|
-
try {
|
|
7740
|
-
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10, env: { 'MOL_RUN_ASYNC': '1' } });
|
|
7697
|
+
'test types'($) {
|
|
7698
|
+
class A {
|
|
7699
|
+
static a() {
|
|
7700
|
+
return '';
|
|
7701
|
+
}
|
|
7702
|
+
static b() {
|
|
7703
|
+
return $mol_wire_async(this).a();
|
|
7704
|
+
}
|
|
7741
7705
|
}
|
|
7742
|
-
|
|
7743
|
-
|
|
7706
|
+
},
|
|
7707
|
+
async 'Latest method calls wins'($) {
|
|
7708
|
+
class NameLogger extends $mol_object2 {
|
|
7709
|
+
static $ = $;
|
|
7710
|
+
static first = [];
|
|
7711
|
+
static last = [];
|
|
7712
|
+
static send(next) {
|
|
7713
|
+
$mol_wire_sync(this.first).push(next);
|
|
7714
|
+
this.$.$mol_wait_timeout(0);
|
|
7715
|
+
this.last.push(next);
|
|
7716
|
+
}
|
|
7744
7717
|
}
|
|
7745
|
-
|
|
7746
|
-
|
|
7718
|
+
const name = $mol_wire_async(NameLogger).send;
|
|
7719
|
+
name('john');
|
|
7720
|
+
const promise = name('jin');
|
|
7721
|
+
$.$mol_after_mock_warp();
|
|
7722
|
+
await promise;
|
|
7723
|
+
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
7724
|
+
$mol_assert_like(NameLogger.last, ['jin']);
|
|
7725
|
+
},
|
|
7726
|
+
async 'Latest function calls wins'($) {
|
|
7727
|
+
const first = [];
|
|
7728
|
+
const last = [];
|
|
7729
|
+
function send_name(next) {
|
|
7730
|
+
$mol_wire_sync(first).push(next);
|
|
7731
|
+
$.$mol_wait_timeout(0);
|
|
7732
|
+
last.push(next);
|
|
7733
|
+
}
|
|
7734
|
+
const name = $mol_wire_async(send_name);
|
|
7735
|
+
name('john');
|
|
7736
|
+
const promise = name('jin');
|
|
7737
|
+
$.$mol_after_mock_warp();
|
|
7738
|
+
await promise;
|
|
7739
|
+
$mol_assert_like(first, ['john', 'jin']);
|
|
7740
|
+
$mol_assert_like(last, ['jin']);
|
|
7741
|
+
},
|
|
7747
7742
|
});
|
|
7748
7743
|
})($ || ($ = {}));
|
|
7749
7744
|
|