mol_jsx_lib 0.0.41 → 0.0.44

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/web.test.js CHANGED
@@ -490,6 +490,25 @@ var $;
490
490
  ;
491
491
  "use strict";
492
492
  var $;
493
+ (function ($) {
494
+ function $mol_promise() {
495
+ let done;
496
+ let fail;
497
+ const promise = new Promise((d, f) => {
498
+ done = d;
499
+ fail = f;
500
+ });
501
+ return Object.assign(promise, {
502
+ done,
503
+ fail,
504
+ });
505
+ }
506
+ $.$mol_promise = $mol_promise;
507
+ })($ || ($ = {}));
508
+ //mol/promise/promise.ts
509
+ ;
510
+ "use strict";
511
+ var $;
493
512
  (function ($) {
494
513
  $.$mol_after_mock_queue = [];
495
514
  function $mol_after_mock_warp() {
@@ -528,6 +547,80 @@ var $;
528
547
  ;
529
548
  "use strict";
530
549
  var $;
550
+ (function ($_1) {
551
+ $mol_test_mocks.push($ => {
552
+ $.$mol_after_timeout = $mol_after_mock_timeout;
553
+ });
554
+ })($ || ($ = {}));
555
+ //mol/after/timeout/timeout.test.ts
556
+ ;
557
+ "use strict";
558
+ var $;
559
+ (function ($) {
560
+ class $mol_after_timeout extends $mol_object2 {
561
+ delay;
562
+ task;
563
+ id;
564
+ constructor(delay, task) {
565
+ super();
566
+ this.delay = delay;
567
+ this.task = task;
568
+ this.id = setTimeout(task, delay);
569
+ }
570
+ destructor() {
571
+ clearTimeout(this.id);
572
+ }
573
+ }
574
+ $.$mol_after_timeout = $mol_after_timeout;
575
+ })($ || ($ = {}));
576
+ //mol/after/timeout/timeout.ts
577
+ ;
578
+ "use strict";
579
+ var $;
580
+ (function ($) {
581
+ function $mol_wire_sync(obj) {
582
+ return new Proxy(obj, {
583
+ get(obj, field) {
584
+ const val = obj[field];
585
+ if (typeof val !== 'function')
586
+ return val;
587
+ const temp = $mol_wire_task.getter(val);
588
+ return function $mol_wire_sync(...args) {
589
+ const fiber = temp(obj, args);
590
+ return fiber.sync();
591
+ };
592
+ },
593
+ apply(obj, self, args) {
594
+ const temp = $mol_wire_task.getter(obj);
595
+ const fiber = temp(self, args);
596
+ return fiber.sync();
597
+ },
598
+ });
599
+ }
600
+ $.$mol_wire_sync = $mol_wire_sync;
601
+ })($ || ($ = {}));
602
+ //mol/wire/sync/sync.ts
603
+ ;
604
+ "use strict";
605
+ var $;
606
+ (function ($) {
607
+ function $mol_wait_timeout_async(timeout) {
608
+ const promise = $mol_promise();
609
+ const task = new this.$mol_after_timeout(timeout, () => promise.done());
610
+ return Object.assign(promise, {
611
+ destructor: () => task.destructor()
612
+ });
613
+ }
614
+ $.$mol_wait_timeout_async = $mol_wait_timeout_async;
615
+ function $mol_wait_timeout(timeout) {
616
+ return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
617
+ }
618
+ $.$mol_wait_timeout = $mol_wait_timeout;
619
+ })($ || ($ = {}));
620
+ //mol/wait/timeout/timeout.ts
621
+ ;
622
+ "use strict";
623
+ var $;
531
624
  (function ($_1) {
532
625
  $mol_test({
533
626
  async 'Latest Calls Wins on Concurrency'($) {
@@ -549,6 +642,15 @@ var $;
549
642
  $mol_assert_like(NameLogger.first, ['john', 'jin']);
550
643
  $mol_assert_like(NameLogger.last, ['jin']);
551
644
  },
645
+ async 'Wrap function'($) {
646
+ const name = $mol_wire_async(function (name) {
647
+ $.$mol_wait_timeout(0);
648
+ return name;
649
+ });
650
+ const promise = name('jin');
651
+ $.$mol_after_mock_warp();
652
+ $mol_assert_like(await promise, 'jin');
653
+ },
552
654
  });
553
655
  })($ || ($ = {}));
554
656
  //mol/wire/async/async.test.ts
@@ -569,7 +671,12 @@ var $;
569
671
  fiber = temp(obj, args);
570
672
  return fiber.async();
571
673
  };
572
- }
674
+ },
675
+ apply(obj, self, args) {
676
+ const temp = $mol_wire_task.getter(obj);
677
+ const fiber = temp(self, args);
678
+ return fiber.async();
679
+ },
573
680
  });
574
681
  }
575
682
  $.$mol_wire_async = $mol_wire_async;
@@ -822,94 +929,6 @@ var $;
822
929
  ;
823
930
  "use strict";
824
931
  var $;
825
- (function ($) {
826
- function $mol_wire_sync(obj) {
827
- return new Proxy(obj, {
828
- get(obj, field) {
829
- const val = obj[field];
830
- if (typeof val !== 'function')
831
- return val;
832
- const temp = $mol_wire_task.getter(val);
833
- return function $mol_wire_sync(...args) {
834
- const fiber = temp(obj, args);
835
- return fiber.sync();
836
- };
837
- }
838
- });
839
- }
840
- $.$mol_wire_sync = $mol_wire_sync;
841
- })($ || ($ = {}));
842
- //mol/wire/sync/sync.ts
843
- ;
844
- "use strict";
845
- var $;
846
- (function ($) {
847
- function $mol_promise() {
848
- let done;
849
- let fail;
850
- const promise = new Promise((d, f) => {
851
- done = d;
852
- fail = f;
853
- });
854
- return Object.assign(promise, {
855
- done,
856
- fail,
857
- });
858
- }
859
- $.$mol_promise = $mol_promise;
860
- })($ || ($ = {}));
861
- //mol/promise/promise.ts
862
- ;
863
- "use strict";
864
- var $;
865
- (function ($_1) {
866
- $mol_test_mocks.push($ => {
867
- $.$mol_after_timeout = $mol_after_mock_timeout;
868
- });
869
- })($ || ($ = {}));
870
- //mol/after/timeout/timeout.test.ts
871
- ;
872
- "use strict";
873
- var $;
874
- (function ($) {
875
- class $mol_after_timeout extends $mol_object2 {
876
- delay;
877
- task;
878
- id;
879
- constructor(delay, task) {
880
- super();
881
- this.delay = delay;
882
- this.task = task;
883
- this.id = setTimeout(task, delay);
884
- }
885
- destructor() {
886
- clearTimeout(this.id);
887
- }
888
- }
889
- $.$mol_after_timeout = $mol_after_timeout;
890
- })($ || ($ = {}));
891
- //mol/after/timeout/timeout.ts
892
- ;
893
- "use strict";
894
- var $;
895
- (function ($) {
896
- function $mol_wait_timeout_async(timeout) {
897
- const promise = $mol_promise();
898
- const task = new this.$mol_after_timeout(timeout, () => promise.done());
899
- return Object.assign(promise, {
900
- destructor: () => task.destructor()
901
- });
902
- }
903
- $.$mol_wait_timeout_async = $mol_wait_timeout_async;
904
- function $mol_wait_timeout(timeout) {
905
- return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
906
- }
907
- $.$mol_wait_timeout = $mol_wait_timeout;
908
- })($ || ($ = {}));
909
- //mol/wait/timeout/timeout.ts
910
- ;
911
- "use strict";
912
- var $;
913
932
  (function ($_1) {
914
933
  $mol_test({
915
934
  'Cached channel'($) {