mol_wire_lib 1.0.1205 → 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/node.test.js
CHANGED
|
@@ -4290,6 +4290,81 @@ var $;
|
|
|
4290
4290
|
;
|
|
4291
4291
|
"use strict";
|
|
4292
4292
|
|
|
4293
|
+
;
|
|
4294
|
+
"use strict";
|
|
4295
|
+
var $;
|
|
4296
|
+
(function ($) {
|
|
4297
|
+
class $mol_after_work extends $mol_object2 {
|
|
4298
|
+
delay;
|
|
4299
|
+
task;
|
|
4300
|
+
id;
|
|
4301
|
+
constructor(delay, task) {
|
|
4302
|
+
super();
|
|
4303
|
+
this.delay = delay;
|
|
4304
|
+
this.task = task;
|
|
4305
|
+
this.id = requestIdleCallback(task, { timeout: delay });
|
|
4306
|
+
}
|
|
4307
|
+
destructor() {
|
|
4308
|
+
cancelIdleCallback(this.id);
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
$.$mol_after_work = $mol_after_work;
|
|
4312
|
+
if (typeof requestIdleCallback !== 'function') {
|
|
4313
|
+
$.$mol_after_work = $mol_after_timeout;
|
|
4314
|
+
}
|
|
4315
|
+
})($ || ($ = {}));
|
|
4316
|
+
|
|
4317
|
+
;
|
|
4318
|
+
"use strict";
|
|
4319
|
+
var $;
|
|
4320
|
+
(function ($_1) {
|
|
4321
|
+
$mol_test_mocks.push($ => {
|
|
4322
|
+
$.$mol_after_work = $mol_after_mock_timeout;
|
|
4323
|
+
});
|
|
4324
|
+
})($ || ($ = {}));
|
|
4325
|
+
|
|
4326
|
+
;
|
|
4327
|
+
"use strict";
|
|
4328
|
+
var $;
|
|
4329
|
+
(function ($) {
|
|
4330
|
+
function $mol_wait_rest_async() {
|
|
4331
|
+
return new Promise(done => {
|
|
4332
|
+
new this.$mol_after_work(16, () => done(null));
|
|
4333
|
+
});
|
|
4334
|
+
}
|
|
4335
|
+
$.$mol_wait_rest_async = $mol_wait_rest_async;
|
|
4336
|
+
function $mol_wait_rest() {
|
|
4337
|
+
return this.$mol_wire_sync(this).$mol_wait_rest_async();
|
|
4338
|
+
}
|
|
4339
|
+
$.$mol_wait_rest = $mol_wait_rest;
|
|
4340
|
+
})($ || ($ = {}));
|
|
4341
|
+
|
|
4342
|
+
;
|
|
4343
|
+
"use strict";
|
|
4344
|
+
var $;
|
|
4345
|
+
(function ($_1) {
|
|
4346
|
+
var $$;
|
|
4347
|
+
(function ($$) {
|
|
4348
|
+
$mol_test_mocks.push($ => {
|
|
4349
|
+
$.$mol_wait_timeout = function $mol_wait_timeout_mock(timeout) { };
|
|
4350
|
+
$.$mol_wait_timeout_async = async function $mol_wait_timeout_async_mock(timeout) { };
|
|
4351
|
+
});
|
|
4352
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
4353
|
+
})($ || ($ = {}));
|
|
4354
|
+
|
|
4355
|
+
;
|
|
4356
|
+
"use strict";
|
|
4357
|
+
var $;
|
|
4358
|
+
(function ($_1) {
|
|
4359
|
+
var $$;
|
|
4360
|
+
(function ($$) {
|
|
4361
|
+
$mol_test_mocks.push($ => {
|
|
4362
|
+
$.$mol_wait_rest = function $mol_wait_rest_mock() { };
|
|
4363
|
+
$.$mol_wait_rest_async = async function $mol_wait_rest_async_mock() { };
|
|
4364
|
+
});
|
|
4365
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
4366
|
+
})($ || ($ = {}));
|
|
4367
|
+
|
|
4293
4368
|
;
|
|
4294
4369
|
"use strict";
|
|
4295
4370
|
var $;
|
|
@@ -4312,7 +4387,7 @@ var $;
|
|
|
4312
4387
|
static last = [];
|
|
4313
4388
|
static send(next) {
|
|
4314
4389
|
$mol_wire_sync(this.first).push(next);
|
|
4315
|
-
|
|
4390
|
+
$$.$mol_wait_timeout(0);
|
|
4316
4391
|
this.last.push(next);
|
|
4317
4392
|
}
|
|
4318
4393
|
}
|
|
@@ -4321,15 +4396,15 @@ var $;
|
|
|
4321
4396
|
const promise = name('jin');
|
|
4322
4397
|
$.$mol_after_mock_warp();
|
|
4323
4398
|
await promise;
|
|
4324
|
-
$
|
|
4325
|
-
$
|
|
4399
|
+
$mol_assert_equal(NameLogger.first, ['john', 'jin']);
|
|
4400
|
+
$mol_assert_equal(NameLogger.last, ['jin']);
|
|
4326
4401
|
},
|
|
4327
4402
|
async 'Latest function calls wins'($) {
|
|
4328
4403
|
const first = [];
|
|
4329
4404
|
const last = [];
|
|
4330
4405
|
function send_name(next) {
|
|
4331
4406
|
$mol_wire_sync(first).push(next);
|
|
4332
|
-
|
|
4407
|
+
$$.$mol_wait_timeout(0);
|
|
4333
4408
|
last.push(next);
|
|
4334
4409
|
}
|
|
4335
4410
|
const name = $mol_wire_async(send_name);
|
|
@@ -4337,8 +4412,8 @@ var $;
|
|
|
4337
4412
|
const promise = name('jin');
|
|
4338
4413
|
$.$mol_after_mock_warp();
|
|
4339
4414
|
await promise;
|
|
4340
|
-
$
|
|
4341
|
-
$
|
|
4415
|
+
$mol_assert_equal(first, ['john', 'jin']);
|
|
4416
|
+
$mol_assert_equal(last, ['jin']);
|
|
4342
4417
|
},
|
|
4343
4418
|
});
|
|
4344
4419
|
})($ || ($ = {}));
|