mol_wire_lib 1.0.1204 → 1.0.1206
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 +1 -6
- package/node.d.ts.map +1 -1
- package/node.js.map +1 -1
- package/node.test.js +81 -6
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +1 -6
- package/web.d.ts.map +1 -1
- package/web.js.map +1 -1
- package/web.test.js +81 -6
- package/web.test.js.map +1 -1
package/web.test.js
CHANGED
|
@@ -1329,7 +1329,7 @@ var $;
|
|
|
1329
1329
|
static last = [];
|
|
1330
1330
|
static send(next) {
|
|
1331
1331
|
$mol_wire_sync(this.first).push(next);
|
|
1332
|
-
|
|
1332
|
+
$$.$mol_wait_timeout(0);
|
|
1333
1333
|
this.last.push(next);
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
@@ -1338,15 +1338,15 @@ var $;
|
|
|
1338
1338
|
const promise = name('jin');
|
|
1339
1339
|
$.$mol_after_mock_warp();
|
|
1340
1340
|
await promise;
|
|
1341
|
-
$
|
|
1342
|
-
$
|
|
1341
|
+
$mol_assert_equal(NameLogger.first, ['john', 'jin']);
|
|
1342
|
+
$mol_assert_equal(NameLogger.last, ['jin']);
|
|
1343
1343
|
},
|
|
1344
1344
|
async 'Latest function calls wins'($) {
|
|
1345
1345
|
const first = [];
|
|
1346
1346
|
const last = [];
|
|
1347
1347
|
function send_name(next) {
|
|
1348
1348
|
$mol_wire_sync(first).push(next);
|
|
1349
|
-
|
|
1349
|
+
$$.$mol_wait_timeout(0);
|
|
1350
1350
|
last.push(next);
|
|
1351
1351
|
}
|
|
1352
1352
|
const name = $mol_wire_async(send_name);
|
|
@@ -1354,8 +1354,8 @@ var $;
|
|
|
1354
1354
|
const promise = name('jin');
|
|
1355
1355
|
$.$mol_after_mock_warp();
|
|
1356
1356
|
await promise;
|
|
1357
|
-
$
|
|
1358
|
-
$
|
|
1357
|
+
$mol_assert_equal(first, ['john', 'jin']);
|
|
1358
|
+
$mol_assert_equal(last, ['jin']);
|
|
1359
1359
|
},
|
|
1360
1360
|
});
|
|
1361
1361
|
})($ || ($ = {}));
|
|
@@ -1413,6 +1413,81 @@ var $;
|
|
|
1413
1413
|
});
|
|
1414
1414
|
})($ || ($ = {}));
|
|
1415
1415
|
|
|
1416
|
+
;
|
|
1417
|
+
"use strict";
|
|
1418
|
+
var $;
|
|
1419
|
+
(function ($) {
|
|
1420
|
+
class $mol_after_work extends $mol_object2 {
|
|
1421
|
+
delay;
|
|
1422
|
+
task;
|
|
1423
|
+
id;
|
|
1424
|
+
constructor(delay, task) {
|
|
1425
|
+
super();
|
|
1426
|
+
this.delay = delay;
|
|
1427
|
+
this.task = task;
|
|
1428
|
+
this.id = requestIdleCallback(task, { timeout: delay });
|
|
1429
|
+
}
|
|
1430
|
+
destructor() {
|
|
1431
|
+
cancelIdleCallback(this.id);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
$.$mol_after_work = $mol_after_work;
|
|
1435
|
+
if (typeof requestIdleCallback !== 'function') {
|
|
1436
|
+
$.$mol_after_work = $mol_after_timeout;
|
|
1437
|
+
}
|
|
1438
|
+
})($ || ($ = {}));
|
|
1439
|
+
|
|
1440
|
+
;
|
|
1441
|
+
"use strict";
|
|
1442
|
+
var $;
|
|
1443
|
+
(function ($_1) {
|
|
1444
|
+
$mol_test_mocks.push($ => {
|
|
1445
|
+
$.$mol_after_work = $mol_after_mock_timeout;
|
|
1446
|
+
});
|
|
1447
|
+
})($ || ($ = {}));
|
|
1448
|
+
|
|
1449
|
+
;
|
|
1450
|
+
"use strict";
|
|
1451
|
+
var $;
|
|
1452
|
+
(function ($) {
|
|
1453
|
+
function $mol_wait_rest_async() {
|
|
1454
|
+
return new Promise(done => {
|
|
1455
|
+
new this.$mol_after_work(16, () => done(null));
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
$.$mol_wait_rest_async = $mol_wait_rest_async;
|
|
1459
|
+
function $mol_wait_rest() {
|
|
1460
|
+
return this.$mol_wire_sync(this).$mol_wait_rest_async();
|
|
1461
|
+
}
|
|
1462
|
+
$.$mol_wait_rest = $mol_wait_rest;
|
|
1463
|
+
})($ || ($ = {}));
|
|
1464
|
+
|
|
1465
|
+
;
|
|
1466
|
+
"use strict";
|
|
1467
|
+
var $;
|
|
1468
|
+
(function ($_1) {
|
|
1469
|
+
var $$;
|
|
1470
|
+
(function ($$) {
|
|
1471
|
+
$mol_test_mocks.push($ => {
|
|
1472
|
+
$.$mol_wait_timeout = function $mol_wait_timeout_mock(timeout) { };
|
|
1473
|
+
$.$mol_wait_timeout_async = async function $mol_wait_timeout_async_mock(timeout) { };
|
|
1474
|
+
});
|
|
1475
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
1476
|
+
})($ || ($ = {}));
|
|
1477
|
+
|
|
1478
|
+
;
|
|
1479
|
+
"use strict";
|
|
1480
|
+
var $;
|
|
1481
|
+
(function ($_1) {
|
|
1482
|
+
var $$;
|
|
1483
|
+
(function ($$) {
|
|
1484
|
+
$mol_test_mocks.push($ => {
|
|
1485
|
+
$.$mol_wait_rest = function $mol_wait_rest_mock() { };
|
|
1486
|
+
$.$mol_wait_rest_async = async function $mol_wait_rest_async_mock() { };
|
|
1487
|
+
});
|
|
1488
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
1489
|
+
})($ || ($ = {}));
|
|
1490
|
+
|
|
1416
1491
|
;
|
|
1417
1492
|
"use strict";
|
|
1418
1493
|
var $;
|