utiller 1.0.129 → 1.0.132
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/lib/pooller/index.js +128 -68
- package/lib/utiller/index.js +51 -48
- package/package.json +1 -1
- package/template/sample.package.json +1 -1
package/lib/pooller/index.js
CHANGED
|
@@ -48,7 +48,7 @@ Pooller 有以下特點:
|
|
|
48
48
|
6.可以設定taskFailHandler, 這樣遇到錯誤就不會停掉poollers
|
|
49
49
|
*
|
|
50
50
|
*/
|
|
51
|
-
var SPECIFICITY_DEBUG =
|
|
51
|
+
var SPECIFICITY_DEBUG = false;
|
|
52
52
|
|
|
53
53
|
var _run = new WeakMap();
|
|
54
54
|
|
|
@@ -355,7 +355,7 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
355
355
|
_this.setState(_configerer.configerer.POOLLER_STATE.RUN_INFINITE);
|
|
356
356
|
|
|
357
357
|
case 14:
|
|
358
|
-
if (
|
|
358
|
+
if (_this.ruleOfStopInfiniteRun()) {
|
|
359
359
|
_context2.next = 20;
|
|
360
360
|
break;
|
|
361
361
|
}
|
|
@@ -376,8 +376,8 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
376
376
|
}
|
|
377
377
|
}, _callee2);
|
|
378
378
|
})));
|
|
379
|
-
(0, _defineProperty2["default"])(this, "
|
|
380
|
-
return _this.isRunning()
|
|
379
|
+
(0, _defineProperty2["default"])(this, "ruleOfStopInfiniteRun", function () {
|
|
380
|
+
return !_this.isRunning() && _this.isExecutingTaskQueueEmpty();
|
|
381
381
|
});
|
|
382
382
|
(0, _defineProperty2["default"])(this, "isExecutingTaskQueueEmpty", function () {
|
|
383
383
|
return _lodash["default"].size(_this.queueOfExecutingTask) === 0;
|
|
@@ -433,7 +433,7 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
433
433
|
_this.setState(_configerer.configerer.POOLLER_STATE.RUN_BY_PARAMS);
|
|
434
434
|
|
|
435
435
|
case 10:
|
|
436
|
-
if (!(_this.
|
|
436
|
+
if (!(!_this.ruleOfStopInfiniteRun() && _lodash["default"].size(_this.queueOfWaitingParam) > 0)) {
|
|
437
437
|
_context3.next = 15;
|
|
438
438
|
break;
|
|
439
439
|
}
|
|
@@ -459,12 +459,14 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
459
459
|
}());
|
|
460
460
|
(0, _defineProperty2["default"])(this, "runByEachTask", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
461
461
|
var tasks,
|
|
462
|
+
self,
|
|
462
463
|
_args4 = arguments;
|
|
463
464
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
464
465
|
while (1) {
|
|
465
466
|
switch (_context4.prev = _context4.next) {
|
|
466
467
|
case 0:
|
|
467
468
|
tasks = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
|
|
469
|
+
self = _this;
|
|
468
470
|
_this.id = _index2.utiller.getRandomHash(15);
|
|
469
471
|
|
|
470
472
|
_this.beforeRun();
|
|
@@ -473,26 +475,32 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
473
475
|
|
|
474
476
|
_this.setState(_configerer.configerer.POOLLER_STATE.RUN_BY_EACH_TASK);
|
|
475
477
|
|
|
476
|
-
case
|
|
477
|
-
if (
|
|
478
|
-
_context4.next =
|
|
478
|
+
case 6:
|
|
479
|
+
if (_this.ruleOfStopInfiniteRun()) {
|
|
480
|
+
_context4.next = 14;
|
|
479
481
|
break;
|
|
480
482
|
}
|
|
481
483
|
|
|
482
|
-
_context4.next =
|
|
484
|
+
_context4.next = 9;
|
|
483
485
|
return (0, _classPrivateFieldGet2["default"])(_this, _run).call(_this, _this.id);
|
|
484
486
|
|
|
485
|
-
case
|
|
487
|
+
case 9:
|
|
486
488
|
if (_this.getCountOfAssignTaskInQueue() <= 0) {
|
|
487
489
|
_this.terminate();
|
|
488
490
|
|
|
489
491
|
_this.printLogMessage("788121, runByEachTask() \u56E0\u70BA taskOfWaitingQueue \u6E05\u7A7A\u800C\u505C\u6B62");
|
|
490
492
|
}
|
|
493
|
+
/** 為了讓while不要停止運算 !this.ruleOfStopInfiniteRun(),不然 runByTask不會停止 */
|
|
494
|
+
|
|
491
495
|
|
|
492
|
-
_context4.next =
|
|
496
|
+
_context4.next = 12;
|
|
497
|
+
return _index2.utiller.syncDelay(10);
|
|
498
|
+
|
|
499
|
+
case 12:
|
|
500
|
+
_context4.next = 6;
|
|
493
501
|
break;
|
|
494
502
|
|
|
495
|
-
case
|
|
503
|
+
case 14:
|
|
496
504
|
case "end":
|
|
497
505
|
return _context4.stop();
|
|
498
506
|
}
|
|
@@ -517,7 +525,7 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
517
525
|
_this.setState(_configerer.configerer.POOLLER_STATE.RUN_BY_TIMES);
|
|
518
526
|
|
|
519
527
|
case 5:
|
|
520
|
-
if (!(_this.
|
|
528
|
+
if (!(!_this.ruleOfStopInfiniteRun() && _this.countsOfRunByTimes > 0)) {
|
|
521
529
|
_context5.next = 10;
|
|
522
530
|
break;
|
|
523
531
|
}
|
|
@@ -1554,7 +1562,10 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1554
1562
|
case 0:
|
|
1555
1563
|
oneToTen = _lodash["default"].range(1, 10);
|
|
1556
1564
|
pool = new InfinitePool(5);
|
|
1557
|
-
|
|
1565
|
+
|
|
1566
|
+
_index2.utiller.appendInfo("....start method of runByParams");
|
|
1567
|
+
|
|
1568
|
+
_context24.next = 5;
|
|
1558
1569
|
return pool.runByParams.apply(pool, [/*#__PURE__*/function () {
|
|
1559
1570
|
var _ref13 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee23(param) {
|
|
1560
1571
|
var ms;
|
|
@@ -1582,7 +1593,10 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1582
1593
|
};
|
|
1583
1594
|
}()].concat((0, _toConsumableArray2["default"])(oneToTen)));
|
|
1584
1595
|
|
|
1585
|
-
case
|
|
1596
|
+
case 5:
|
|
1597
|
+
_index2.utiller.appendInfo("....finish method of runByParams");
|
|
1598
|
+
|
|
1599
|
+
case 6:
|
|
1586
1600
|
case "end":
|
|
1587
1601
|
return _context24.stop();
|
|
1588
1602
|
}
|
|
@@ -1597,23 +1611,66 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1597
1611
|
return exampleOfRunByParam;
|
|
1598
1612
|
}()
|
|
1599
1613
|
}, {
|
|
1600
|
-
key: "
|
|
1614
|
+
key: "exampleOfRunByTask",
|
|
1615
|
+
value: function () {
|
|
1616
|
+
var _exampleOfRunByTask = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee25() {
|
|
1617
|
+
var pool, tasks, all;
|
|
1618
|
+
return _regenerator["default"].wrap(function _callee25$(_context25) {
|
|
1619
|
+
while (1) {
|
|
1620
|
+
switch (_context25.prev = _context25.next) {
|
|
1621
|
+
case 0:
|
|
1622
|
+
pool = new InfinitePool(10);
|
|
1623
|
+
tasks = _lodash["default"].range(1, 5).map(function (each) {
|
|
1624
|
+
return _index2.utiller.asyncUnitTaskFunction(each);
|
|
1625
|
+
});
|
|
1626
|
+
|
|
1627
|
+
_index2.utiller.appendInfo("....start method of exampleOfRunByTask");
|
|
1628
|
+
|
|
1629
|
+
_context25.next = 5;
|
|
1630
|
+
return pool.runByEachTask(tasks);
|
|
1631
|
+
|
|
1632
|
+
case 5:
|
|
1633
|
+
all = _context25.sent;
|
|
1634
|
+
|
|
1635
|
+
_index2.utiller.appendInfo(all);
|
|
1636
|
+
|
|
1637
|
+
_index2.utiller.appendInfo("....finish method of exampleOfRunByTask");
|
|
1638
|
+
|
|
1639
|
+
case 8:
|
|
1640
|
+
case "end":
|
|
1641
|
+
return _context25.stop();
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
}, _callee25);
|
|
1645
|
+
}));
|
|
1646
|
+
|
|
1647
|
+
function exampleOfRunByTask() {
|
|
1648
|
+
return _exampleOfRunByTask.apply(this, arguments);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
return exampleOfRunByTask;
|
|
1652
|
+
}()
|
|
1653
|
+
}, {
|
|
1654
|
+
key: "exampleOfRunByTimes",
|
|
1601
1655
|
value: function () {
|
|
1602
|
-
var
|
|
1656
|
+
var _exampleOfRunByTimes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee27() {
|
|
1603
1657
|
var pool, time;
|
|
1604
|
-
return _regenerator["default"].wrap(function
|
|
1658
|
+
return _regenerator["default"].wrap(function _callee27$(_context27) {
|
|
1605
1659
|
while (1) {
|
|
1606
|
-
switch (
|
|
1660
|
+
switch (_context27.prev = _context27.next) {
|
|
1607
1661
|
case 0:
|
|
1608
|
-
pool = new InfinitePool(
|
|
1662
|
+
pool = new InfinitePool(5);
|
|
1609
1663
|
time = 0;
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1664
|
+
|
|
1665
|
+
_index2.utiller.appendInfo("....start method of runByTimes");
|
|
1666
|
+
|
|
1667
|
+
_context27.next = 5;
|
|
1668
|
+
return pool.runByTimes( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee26() {
|
|
1669
|
+
return _regenerator["default"].wrap(function _callee26$(_context26) {
|
|
1613
1670
|
while (1) {
|
|
1614
|
-
switch (
|
|
1671
|
+
switch (_context26.prev = _context26.next) {
|
|
1615
1672
|
case 0:
|
|
1616
|
-
|
|
1673
|
+
_context26.next = 2;
|
|
1617
1674
|
return _index2.utiller.syncDelay(1000);
|
|
1618
1675
|
|
|
1619
1676
|
case 2:
|
|
@@ -1622,68 +1679,71 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1622
1679
|
|
|
1623
1680
|
case 4:
|
|
1624
1681
|
case "end":
|
|
1625
|
-
return
|
|
1682
|
+
return _context26.stop();
|
|
1626
1683
|
}
|
|
1627
1684
|
}
|
|
1628
|
-
},
|
|
1629
|
-
})),
|
|
1685
|
+
}, _callee26);
|
|
1686
|
+
})), 10);
|
|
1630
1687
|
|
|
1631
|
-
case
|
|
1688
|
+
case 5:
|
|
1689
|
+
_index2.utiller.appendInfo("....finish method of runByTimes");
|
|
1690
|
+
|
|
1691
|
+
case 6:
|
|
1632
1692
|
case "end":
|
|
1633
|
-
return
|
|
1693
|
+
return _context27.stop();
|
|
1634
1694
|
}
|
|
1635
1695
|
}
|
|
1636
|
-
},
|
|
1696
|
+
}, _callee27);
|
|
1637
1697
|
}));
|
|
1638
1698
|
|
|
1639
|
-
function
|
|
1640
|
-
return
|
|
1699
|
+
function exampleOfRunByTimes() {
|
|
1700
|
+
return _exampleOfRunByTimes.apply(this, arguments);
|
|
1641
1701
|
}
|
|
1642
1702
|
|
|
1643
|
-
return
|
|
1703
|
+
return exampleOfRunByTimes;
|
|
1644
1704
|
}()
|
|
1645
1705
|
}, {
|
|
1646
1706
|
key: "exampleOfInfiniteUnStopLoopingIssue",
|
|
1647
1707
|
value: function () {
|
|
1648
|
-
var _exampleOfInfiniteUnStopLoopingIssue = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
1708
|
+
var _exampleOfInfiniteUnStopLoopingIssue = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee29() {
|
|
1649
1709
|
var persistTone, _persistTone, poollers, pool, isRequiredTerminate, random, _iterator6, _step6, pooller;
|
|
1650
1710
|
|
|
1651
|
-
return _regenerator["default"].wrap(function
|
|
1711
|
+
return _regenerator["default"].wrap(function _callee29$(_context29) {
|
|
1652
1712
|
while (1) {
|
|
1653
|
-
switch (
|
|
1713
|
+
switch (_context29.prev = _context29.next) {
|
|
1654
1714
|
case 0:
|
|
1655
1715
|
_persistTone = function _persistTone3() {
|
|
1656
|
-
_persistTone = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
1716
|
+
_persistTone = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee28() {
|
|
1657
1717
|
var sign, time;
|
|
1658
|
-
return _regenerator["default"].wrap(function
|
|
1718
|
+
return _regenerator["default"].wrap(function _callee28$(_context28) {
|
|
1659
1719
|
while (1) {
|
|
1660
|
-
switch (
|
|
1720
|
+
switch (_context28.prev = _context28.next) {
|
|
1661
1721
|
case 0:
|
|
1662
|
-
|
|
1722
|
+
_context28.prev = 0;
|
|
1663
1723
|
sign = _index2.utiller.getRandomHash(20);
|
|
1664
|
-
|
|
1724
|
+
_context28.next = 4;
|
|
1665
1725
|
return _index2.utiller.syncDelayRandom(1, 10);
|
|
1666
1726
|
|
|
1667
1727
|
case 4:
|
|
1668
|
-
time =
|
|
1728
|
+
time = _context28.sent;
|
|
1669
1729
|
|
|
1670
1730
|
_index2.utiller.appendInfo("".concat(time, " ms, yoyoyo ").concat(sign)); // Util.appendInfo(`沒有TONE可以下載了....隨機睡個${await Util.syncDelayRandom(1500, 3500)}`)
|
|
1671
1731
|
|
|
1672
1732
|
|
|
1673
|
-
return
|
|
1733
|
+
return _context28.abrupt("return", "\u4EFB\u52D9ID:".concat(sign));
|
|
1674
1734
|
|
|
1675
1735
|
case 9:
|
|
1676
|
-
|
|
1677
|
-
|
|
1736
|
+
_context28.prev = 9;
|
|
1737
|
+
_context28.t0 = _context28["catch"](0);
|
|
1678
1738
|
|
|
1679
|
-
_index2.utiller.appendError(
|
|
1739
|
+
_index2.utiller.appendError(_context28.t0.message);
|
|
1680
1740
|
|
|
1681
1741
|
case 12:
|
|
1682
1742
|
case "end":
|
|
1683
|
-
return
|
|
1743
|
+
return _context28.stop();
|
|
1684
1744
|
}
|
|
1685
1745
|
}
|
|
1686
|
-
},
|
|
1746
|
+
}, _callee28, null, [[0, 9]]);
|
|
1687
1747
|
}));
|
|
1688
1748
|
return _persistTone.apply(this, arguments);
|
|
1689
1749
|
};
|
|
@@ -1708,7 +1768,7 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1708
1768
|
|
|
1709
1769
|
case 11:
|
|
1710
1770
|
if (!true) {
|
|
1711
|
-
|
|
1771
|
+
_context29.next = 43;
|
|
1712
1772
|
break;
|
|
1713
1773
|
}
|
|
1714
1774
|
|
|
@@ -1716,30 +1776,30 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1716
1776
|
return each.showState();
|
|
1717
1777
|
});
|
|
1718
1778
|
|
|
1719
|
-
|
|
1779
|
+
_context29.next = 15;
|
|
1720
1780
|
return _index2.utiller.syncDelayRandom();
|
|
1721
1781
|
|
|
1722
1782
|
case 15:
|
|
1723
|
-
random =
|
|
1724
|
-
|
|
1783
|
+
random = _context29.sent;
|
|
1784
|
+
_context29.next = 18;
|
|
1725
1785
|
return _index2.utiller.syncDelay(random);
|
|
1726
1786
|
|
|
1727
1787
|
case 18:
|
|
1728
1788
|
if (!isRequiredTerminate) {
|
|
1729
|
-
|
|
1789
|
+
_context29.next = 41;
|
|
1730
1790
|
break;
|
|
1731
1791
|
}
|
|
1732
1792
|
|
|
1733
1793
|
_index2.utiller.appendInfo("\u4E3B\u7DDA\u7A0B\u6536\u5230\u95DC\u9589\u6307\u4EE4...");
|
|
1734
1794
|
|
|
1735
1795
|
_iterator6 = _createForOfIteratorHelper(poollers);
|
|
1736
|
-
|
|
1796
|
+
_context29.prev = 21;
|
|
1737
1797
|
|
|
1738
1798
|
_iterator6.s();
|
|
1739
1799
|
|
|
1740
1800
|
case 23:
|
|
1741
1801
|
if ((_step6 = _iterator6.n()).done) {
|
|
1742
|
-
|
|
1802
|
+
_context29.next = 32;
|
|
1743
1803
|
break;
|
|
1744
1804
|
}
|
|
1745
1805
|
|
|
@@ -1747,7 +1807,7 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1747
1807
|
|
|
1748
1808
|
_index2.utiller.appendInfo("POOLER ".concat(pooller.getPoolId(), " \u6B63\u5728\u95DC\u9589\u4E2D"));
|
|
1749
1809
|
|
|
1750
|
-
|
|
1810
|
+
_context29.next = 28;
|
|
1751
1811
|
return pooller.stopInBackground();
|
|
1752
1812
|
|
|
1753
1813
|
case 28:
|
|
@@ -1756,39 +1816,39 @@ var InfinitePool = /*#__PURE__*/function () {
|
|
|
1756
1816
|
_index2.utiller.appendInfo("POOLER ".concat(pooller.getPoolId(), " \u95DC\u9589\u6210\u529F!"));
|
|
1757
1817
|
|
|
1758
1818
|
case 30:
|
|
1759
|
-
|
|
1819
|
+
_context29.next = 23;
|
|
1760
1820
|
break;
|
|
1761
1821
|
|
|
1762
1822
|
case 32:
|
|
1763
|
-
|
|
1823
|
+
_context29.next = 37;
|
|
1764
1824
|
break;
|
|
1765
1825
|
|
|
1766
1826
|
case 34:
|
|
1767
|
-
|
|
1768
|
-
|
|
1827
|
+
_context29.prev = 34;
|
|
1828
|
+
_context29.t0 = _context29["catch"](21);
|
|
1769
1829
|
|
|
1770
|
-
_iterator6.e(
|
|
1830
|
+
_iterator6.e(_context29.t0);
|
|
1771
1831
|
|
|
1772
1832
|
case 37:
|
|
1773
|
-
|
|
1833
|
+
_context29.prev = 37;
|
|
1774
1834
|
|
|
1775
1835
|
_iterator6.f();
|
|
1776
1836
|
|
|
1777
|
-
return
|
|
1837
|
+
return _context29.finish(37);
|
|
1778
1838
|
|
|
1779
1839
|
case 40:
|
|
1780
|
-
return
|
|
1840
|
+
return _context29.abrupt("break", 43);
|
|
1781
1841
|
|
|
1782
1842
|
case 41:
|
|
1783
|
-
|
|
1843
|
+
_context29.next = 11;
|
|
1784
1844
|
break;
|
|
1785
1845
|
|
|
1786
1846
|
case 43:
|
|
1787
1847
|
case "end":
|
|
1788
|
-
return
|
|
1848
|
+
return _context29.stop();
|
|
1789
1849
|
}
|
|
1790
1850
|
}
|
|
1791
|
-
},
|
|
1851
|
+
}, _callee29, null, [[21, 34, 37, 40]]);
|
|
1792
1852
|
}));
|
|
1793
1853
|
|
|
1794
1854
|
function exampleOfInfiniteUnStopLoopingIssue() {
|
package/lib/utiller/index.js
CHANGED
|
@@ -79,64 +79,62 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
79
79
|
var _funparam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "預設的param";
|
|
80
80
|
|
|
81
81
|
var errorSimulator = arguments.length > 2 ? arguments[2] : undefined;
|
|
82
|
-
return /*#__PURE__*/function () {
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
return /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
83
|
+
var param,
|
|
84
|
+
randomValue,
|
|
85
|
+
symbol,
|
|
86
|
+
_args = arguments;
|
|
87
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
88
|
+
while (1) {
|
|
89
|
+
switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
param = _args.length > 0 && _args[0] !== undefined ? _args[0] : _this.getRandomHash(10);
|
|
92
|
+
randomValue = _this.getRandomValue(millionSec, millionSec * 1.2);
|
|
93
|
+
_context.prev = 2;
|
|
94
|
+
symbol = randomValue;
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
_this.appendInfo("before executed ===> i'm symbol of ".concat(symbol, ", ready to be executed, inner param = ").concat(_funparam));
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
_context.next = 7;
|
|
99
|
+
return _this.syncDelay(randomValue);
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
case 7:
|
|
102
|
+
if (!(_lodash["default"].isFunction(errorSimulator) && errorSimulator(param))) {
|
|
103
|
+
_context.next = 9;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
throw Error("force to made error happen");
|
|
105
108
|
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
case 9:
|
|
110
|
+
_this.appendInfo("after executed ===> i'm symbol of ".concat(symbol, ", the task cost ").concat(randomValue, " million-seconds ").concat(param ? "i hav params ===> ".concat(param) : ""));
|
|
108
111
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
return _context.abrupt("return", {
|
|
113
|
+
randomValue: randomValue,
|
|
114
|
+
symbol: symbol,
|
|
115
|
+
param: param
|
|
116
|
+
});
|
|
114
117
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
case 13:
|
|
119
|
+
_context.prev = 13;
|
|
120
|
+
_context.t0 = _context["catch"](2);
|
|
118
121
|
|
|
119
|
-
|
|
122
|
+
_this.appendError(new Error("asyncUnitTask() catch error ".concat(_context.t0.message)));
|
|
120
123
|
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
case 16:
|
|
125
|
+
_context.prev = 16;
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
_this.appendInfo("wow.... finally got you");
|
|
125
128
|
|
|
126
|
-
|
|
129
|
+
return _context.finish(16);
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
131
|
+
case 19:
|
|
132
|
+
case "end":
|
|
133
|
+
return _context.stop();
|
|
132
134
|
}
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
return function (_x) {
|
|
137
|
-
return _ref.apply(this, arguments);
|
|
138
|
-
};
|
|
139
|
-
}();
|
|
135
|
+
}
|
|
136
|
+
}, _callee, null, [[2, 13, 16, 19]]);
|
|
137
|
+
}));
|
|
140
138
|
});
|
|
141
139
|
(0, _defineProperty2["default"])(this, "getCallersName", function () {
|
|
142
140
|
var callerName;
|
|
@@ -555,13 +553,18 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
555
553
|
}()
|
|
556
554
|
/** 如果是array,用 indexOf檢查each
|
|
557
555
|
* 如果是object,看有沒有這個key
|
|
558
|
-
* 如果是string, 就檢查有沒有包含
|
|
556
|
+
* 如果是string, 就檢查有沒有包含
|
|
557
|
+
* precisely 就是用findIndex,去比較value
|
|
558
|
+
*
|
|
559
|
+
* */
|
|
559
560
|
|
|
560
561
|
}, {
|
|
561
562
|
key: "has",
|
|
562
563
|
value: function has(collection, item) {
|
|
564
|
+
var precisely = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
565
|
+
|
|
563
566
|
if (_lodash["default"].isArray(collection)) {
|
|
564
|
-
return _lodash["default"].indexOf(collection, item) > -1;
|
|
567
|
+
if (precisely) return _lodash["default"].findIndex(collection, item) > -1;else return _lodash["default"].indexOf(collection, item) > -1;
|
|
565
568
|
}
|
|
566
569
|
|
|
567
570
|
if (_lodash["default"].isObject(item)) {
|
|
@@ -1114,7 +1117,7 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
1114
1117
|
}, _callee5, null, [[3, 12, 15, 18]]);
|
|
1115
1118
|
}));
|
|
1116
1119
|
|
|
1117
|
-
function asyncPool(_x2, _x3
|
|
1120
|
+
function asyncPool(_x, _x2, _x3) {
|
|
1118
1121
|
return _asyncPool.apply(this, arguments);
|
|
1119
1122
|
}
|
|
1120
1123
|
|
package/package.json
CHANGED