@whitesev/utils 1.2.2 → 1.3.1
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/dist/index.amd.js +274 -207
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +274 -207
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +274 -207
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +274 -207
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +274 -207
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +274 -207
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Utils.d.ts +225 -93
- package/package.json +1 -1
- package/src/Utils.ts +566 -344
package/dist/index.system.js
CHANGED
|
@@ -3174,7 +3174,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3174
3174
|
/// <reference path="./ajaxHooker/index.d.ts" />
|
|
3175
3175
|
class Utils {
|
|
3176
3176
|
/** 版本号 */
|
|
3177
|
-
version = "2024.5.
|
|
3177
|
+
version = "2024.5.30";
|
|
3178
3178
|
addStyle(cssText) {
|
|
3179
3179
|
if (typeof cssText !== "string") {
|
|
3180
3180
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -5601,251 +5601,318 @@ System.register('Utils', [], (function (exports) {
|
|
|
5601
5601
|
await UtilsContext.tryCatch(index, item).run(handleFunc);
|
|
5602
5602
|
}));
|
|
5603
5603
|
}
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5604
|
+
waitNode(...args) {
|
|
5605
|
+
// 过滤掉undefined
|
|
5606
|
+
args = args.filter((arg) => arg !== void 0);
|
|
5607
|
+
let that = this;
|
|
5608
|
+
// 选择器
|
|
5609
|
+
let selector = args[0];
|
|
5610
|
+
// 父元素(监听的元素)
|
|
5611
|
+
let parent = UtilsCore.document;
|
|
5612
|
+
// 超时时间
|
|
5613
|
+
let timeout = 0;
|
|
5614
|
+
if (typeof args[0] !== "string" && !Array.isArray(args[0])) {
|
|
5615
|
+
throw new TypeError("Utils.waitNode 第一个参数必须是string|string[]");
|
|
5616
|
+
}
|
|
5617
|
+
if (args.length === 1) ;
|
|
5618
|
+
else if (args.length === 2) {
|
|
5619
|
+
let secondParam = args[1];
|
|
5620
|
+
if (typeof secondParam === "number") {
|
|
5621
|
+
// "div",10000
|
|
5622
|
+
timeout = secondParam;
|
|
5623
|
+
}
|
|
5624
|
+
else if (typeof secondParam === "object" &&
|
|
5625
|
+
secondParam instanceof Node) {
|
|
5626
|
+
// "div",document
|
|
5627
|
+
parent = secondParam;
|
|
5628
|
+
}
|
|
5629
|
+
else {
|
|
5630
|
+
throw new TypeError("Utils.waitNode 第二个参数必须是number|Node");
|
|
5631
|
+
}
|
|
5632
|
+
}
|
|
5633
|
+
else if (args.length === 3) {
|
|
5634
|
+
// "div",document,10000
|
|
5635
|
+
// 第二个参数,parent
|
|
5636
|
+
let secondParam = args[1];
|
|
5637
|
+
// 第三个参数,timeout
|
|
5638
|
+
let thirdParam = args[2];
|
|
5639
|
+
if (typeof secondParam === "object" && secondParam instanceof Node) {
|
|
5640
|
+
parent = secondParam;
|
|
5641
|
+
if (typeof thirdParam === "number") {
|
|
5642
|
+
timeout = thirdParam;
|
|
5643
|
+
}
|
|
5644
|
+
else {
|
|
5645
|
+
throw new TypeError("Utils.waitNode 第三个参数必须是number");
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
else {
|
|
5649
|
+
throw new TypeError("Utils.waitNode 第二个参数必须是Node");
|
|
5609
5650
|
}
|
|
5610
5651
|
}
|
|
5611
|
-
|
|
5652
|
+
else {
|
|
5653
|
+
throw new TypeError("Utils.waitNode 参数个数错误");
|
|
5654
|
+
}
|
|
5612
5655
|
return new Promise((resolve) => {
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
let selectNodeArray = [];
|
|
5622
|
-
for (let selector of nodeSelectors) {
|
|
5623
|
-
let element = document.querySelector(selector);
|
|
5624
|
-
if (!element) {
|
|
5625
|
-
/* 没找到,直接退出循环 */
|
|
5626
|
-
isFind = false;
|
|
5627
|
-
break;
|
|
5656
|
+
function getNode() {
|
|
5657
|
+
if (Array.isArray(selector)) {
|
|
5658
|
+
let result = [];
|
|
5659
|
+
for (let index = 0; index < selector.length; index++) {
|
|
5660
|
+
let node = parent.querySelector(selector[index]);
|
|
5661
|
+
if (node) {
|
|
5662
|
+
result.push(node);
|
|
5663
|
+
}
|
|
5628
5664
|
}
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
if (isFind) {
|
|
5632
|
-
isReturn = true;
|
|
5633
|
-
observer?.disconnect();
|
|
5634
|
-
/* 如果只有一个选择器,那么返回数组中存储的第一个 */
|
|
5635
|
-
if (selectNodeArray.length === 1) {
|
|
5636
|
-
resolve(selectNodeArray[0]);
|
|
5637
|
-
}
|
|
5638
|
-
else {
|
|
5639
|
-
resolve(selectNodeArray);
|
|
5665
|
+
if (result.length === selector.length) {
|
|
5666
|
+
return result;
|
|
5640
5667
|
}
|
|
5641
5668
|
}
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5669
|
+
else {
|
|
5670
|
+
return parent.querySelector(selector);
|
|
5671
|
+
}
|
|
5672
|
+
}
|
|
5673
|
+
let node = getNode();
|
|
5674
|
+
if (node) {
|
|
5675
|
+
resolve(node);
|
|
5676
|
+
return;
|
|
5677
|
+
}
|
|
5678
|
+
let observer = that.mutationObserver(parent, {
|
|
5679
|
+
config: {
|
|
5680
|
+
subtree: true,
|
|
5681
|
+
childList: true,
|
|
5682
|
+
attributes: true,
|
|
5683
|
+
},
|
|
5684
|
+
callback() {
|
|
5685
|
+
let node = getNode();
|
|
5686
|
+
if (node) {
|
|
5687
|
+
// 取消观察器
|
|
5688
|
+
observer.disconnect();
|
|
5689
|
+
resolve(node);
|
|
5650
5690
|
return;
|
|
5651
5691
|
}
|
|
5652
|
-
checkNodes(observer);
|
|
5653
5692
|
},
|
|
5654
5693
|
});
|
|
5694
|
+
if (timeout > 0) {
|
|
5695
|
+
setTimeout(() => {
|
|
5696
|
+
// 取消观察器
|
|
5697
|
+
observer.disconnect();
|
|
5698
|
+
resolve(null);
|
|
5699
|
+
}, timeout);
|
|
5700
|
+
}
|
|
5655
5701
|
});
|
|
5656
5702
|
}
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5703
|
+
waitAnyNode(...args) {
|
|
5704
|
+
// 过滤掉undefined
|
|
5705
|
+
args = args.filter((arg) => arg !== void 0);
|
|
5706
|
+
let that = this;
|
|
5707
|
+
// 选择器
|
|
5708
|
+
let selectorList = args[0];
|
|
5709
|
+
// 父元素(监听的元素)
|
|
5710
|
+
let parent = UtilsCore.document;
|
|
5711
|
+
// 超时时间
|
|
5712
|
+
let timeout = 0;
|
|
5713
|
+
if (typeof args[0] !== "object" && !Array.isArray(args[0])) {
|
|
5714
|
+
throw new TypeError("Utils.waitAnyNode 第一个参数必须是string[]");
|
|
5715
|
+
}
|
|
5716
|
+
if (args.length === 1) ;
|
|
5717
|
+
else if (args.length === 2) {
|
|
5718
|
+
let secondParam = args[1];
|
|
5719
|
+
if (typeof secondParam === "number") {
|
|
5720
|
+
// "div",10000
|
|
5721
|
+
timeout = secondParam;
|
|
5722
|
+
}
|
|
5723
|
+
else if (typeof secondParam === "object" &&
|
|
5724
|
+
secondParam instanceof Node) {
|
|
5725
|
+
// "div",document
|
|
5726
|
+
parent = secondParam;
|
|
5727
|
+
}
|
|
5728
|
+
else {
|
|
5729
|
+
throw new TypeError("Utils.waitAnyNode 第二个参数必须是number|Node");
|
|
5730
|
+
}
|
|
5731
|
+
}
|
|
5732
|
+
else if (args.length === 3) {
|
|
5733
|
+
// "div",document,10000
|
|
5734
|
+
// 第二个参数,parent
|
|
5735
|
+
let secondParam = args[1];
|
|
5736
|
+
// 第三个参数,timeout
|
|
5737
|
+
let thirdParam = args[2];
|
|
5738
|
+
if (typeof secondParam === "object" && secondParam instanceof Node) {
|
|
5739
|
+
parent = secondParam;
|
|
5740
|
+
if (typeof thirdParam === "number") {
|
|
5741
|
+
timeout = thirdParam;
|
|
5742
|
+
}
|
|
5743
|
+
else {
|
|
5744
|
+
throw new TypeError("Utils.waitAnyNode 第三个参数必须是number");
|
|
5665
5745
|
}
|
|
5666
5746
|
}
|
|
5667
|
-
|
|
5747
|
+
else {
|
|
5748
|
+
throw new TypeError("Utils.waitAnyNode 第二个参数必须是Node");
|
|
5749
|
+
}
|
|
5668
5750
|
}
|
|
5669
5751
|
else {
|
|
5670
|
-
|
|
5752
|
+
throw new TypeError("Utils.waitAnyNode 参数个数错误");
|
|
5671
5753
|
}
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
let isReturn = false;
|
|
5675
|
-
/* 检查所有选择器是否匹配到节点 */
|
|
5676
|
-
let checkNodes = (observer) => {
|
|
5677
|
-
let isFind = true;
|
|
5678
|
-
let selectNodeArray = [];
|
|
5679
|
-
for (let selector of nodeSelectors) {
|
|
5680
|
-
let element = document.querySelector(selector);
|
|
5681
|
-
if (!element) {
|
|
5682
|
-
/* 没找到,直接退出循环 */
|
|
5683
|
-
isFind = false;
|
|
5684
|
-
break;
|
|
5685
|
-
}
|
|
5686
|
-
selectNodeArray.push(element);
|
|
5687
|
-
}
|
|
5688
|
-
if (isFind) {
|
|
5689
|
-
isReturn = true;
|
|
5690
|
-
observer?.disconnect();
|
|
5691
|
-
/* 如果只有一个选择器,那么返回数组中存储的第一个 */
|
|
5692
|
-
if (selectNodeArray.length === 1) {
|
|
5693
|
-
resolve(selectNodeArray[0]);
|
|
5694
|
-
}
|
|
5695
|
-
else {
|
|
5696
|
-
resolve(selectNodeArray);
|
|
5697
|
-
}
|
|
5698
|
-
}
|
|
5699
|
-
};
|
|
5700
|
-
/* 在函数开始时检查节点是否已经存在 */
|
|
5701
|
-
checkNodes();
|
|
5702
|
-
/* 监听 DOM 的变化,直到至少有一个节点被匹配到 */
|
|
5703
|
-
let mutationObserver = UtilsContext.mutationObserver(document.documentElement, {
|
|
5704
|
-
config: { subtree: true, childList: true, attributes: true },
|
|
5705
|
-
callback: (mutations, observer) => {
|
|
5706
|
-
if (isReturn) {
|
|
5707
|
-
return;
|
|
5708
|
-
}
|
|
5709
|
-
checkNodes(observer);
|
|
5710
|
-
},
|
|
5711
|
-
});
|
|
5712
|
-
setTimeout(() => {
|
|
5713
|
-
mutationObserver.disconnect();
|
|
5714
|
-
reject();
|
|
5715
|
-
}, maxTime);
|
|
5754
|
+
let promiseList = selectorList.map((selector) => {
|
|
5755
|
+
return that.waitNode(selector, parent, timeout);
|
|
5716
5756
|
});
|
|
5757
|
+
return Promise.any(promiseList);
|
|
5717
5758
|
}
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5759
|
+
waitNodeList(...args) {
|
|
5760
|
+
// 过滤掉undefined
|
|
5761
|
+
args = args.filter((arg) => arg !== void 0);
|
|
5762
|
+
let that = this;
|
|
5763
|
+
// 选择器数组
|
|
5764
|
+
let selector = args[0];
|
|
5765
|
+
// 父元素(监听的元素)
|
|
5766
|
+
let parent = UtilsCore.document;
|
|
5767
|
+
// 超时时间
|
|
5768
|
+
let timeout = 0;
|
|
5769
|
+
if (typeof args[0] !== "string" && !Array.isArray(args[0])) {
|
|
5770
|
+
throw new TypeError("Utils.waitNodeList 第一个参数必须是string|string[]");
|
|
5771
|
+
}
|
|
5772
|
+
if (args.length === 1) ;
|
|
5773
|
+
else if (args.length === 2) {
|
|
5774
|
+
let secondParam = args[1];
|
|
5775
|
+
if (typeof secondParam === "number") {
|
|
5776
|
+
// "div",10000
|
|
5777
|
+
timeout = secondParam;
|
|
5778
|
+
}
|
|
5779
|
+
else if (typeof secondParam === "object" &&
|
|
5780
|
+
secondParam instanceof Node) {
|
|
5781
|
+
// "div",document
|
|
5782
|
+
parent = secondParam;
|
|
5724
5783
|
}
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5784
|
+
else {
|
|
5785
|
+
throw new TypeError("Utils.waitNodeList 第二个参数必须是number|Node");
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
else if (args.length === 3) {
|
|
5789
|
+
// "div",document,10000
|
|
5790
|
+
// 第二个参数,parent
|
|
5791
|
+
let secondParam = args[1];
|
|
5792
|
+
// 第三个参数,timeout
|
|
5793
|
+
let thirdParam = args[2];
|
|
5794
|
+
if (typeof secondParam === "object" && secondParam instanceof Node) {
|
|
5795
|
+
parent = secondParam;
|
|
5796
|
+
if (typeof thirdParam === "number") {
|
|
5797
|
+
timeout = thirdParam;
|
|
5738
5798
|
}
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
observer?.disconnect();
|
|
5742
|
-
resolve(selectNode);
|
|
5799
|
+
else {
|
|
5800
|
+
throw new TypeError("Utils.waitNodeList 第三个参数必须是number");
|
|
5743
5801
|
}
|
|
5744
|
-
}
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
/* 监听 DOM 的变化,直到至少有一个节点被匹配到 */
|
|
5748
|
-
UtilsContext.mutationObserver(document.documentElement, {
|
|
5749
|
-
config: { subtree: true, childList: true, attributes: true },
|
|
5750
|
-
callback: (mutations, observer) => {
|
|
5751
|
-
if (isReturn) {
|
|
5752
|
-
return;
|
|
5753
|
-
}
|
|
5754
|
-
checkNodes(observer);
|
|
5755
|
-
},
|
|
5756
|
-
});
|
|
5757
|
-
});
|
|
5758
|
-
}
|
|
5759
|
-
waitNodeList(...nodeSelectors) {
|
|
5760
|
-
let UtilsContext = this;
|
|
5761
|
-
/* 检查每个参数是否为字符串类型 */
|
|
5762
|
-
for (let nodeSelector of nodeSelectors) {
|
|
5763
|
-
if (typeof nodeSelector !== "string") {
|
|
5764
|
-
throw new Error("Utils.waitNode 参数必须为 ...string 类型");
|
|
5802
|
+
}
|
|
5803
|
+
else {
|
|
5804
|
+
throw new TypeError("Utils.waitNodeList 第二个参数必须是Node");
|
|
5765
5805
|
}
|
|
5766
5806
|
}
|
|
5807
|
+
else {
|
|
5808
|
+
throw new TypeError("Utils.waitNodeList 参数个数错误");
|
|
5809
|
+
}
|
|
5767
5810
|
return new Promise((resolve) => {
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
if (nodeList.length === 0) {
|
|
5777
|
-
/* 没找到,直接退出循环 */
|
|
5778
|
-
isFind = false;
|
|
5779
|
-
break;
|
|
5811
|
+
function getNodeList() {
|
|
5812
|
+
if (Array.isArray(selector)) {
|
|
5813
|
+
let result = [];
|
|
5814
|
+
for (let index = 0; index < selector.length; index++) {
|
|
5815
|
+
let nodeList = parent.querySelectorAll(selector[index]);
|
|
5816
|
+
if (nodeList.length) {
|
|
5817
|
+
result.push(nodeList);
|
|
5818
|
+
}
|
|
5780
5819
|
}
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
if (isFind) {
|
|
5784
|
-
isReturn = true;
|
|
5785
|
-
observer?.disconnect();
|
|
5786
|
-
/* 如果只有一个选择器,那么返回第一个 */
|
|
5787
|
-
if (selectNodes.length === 1) {
|
|
5788
|
-
resolve(selectNodes[0]);
|
|
5820
|
+
if (result.length === selector.length) {
|
|
5821
|
+
return result;
|
|
5789
5822
|
}
|
|
5790
|
-
|
|
5791
|
-
|
|
5823
|
+
}
|
|
5824
|
+
else {
|
|
5825
|
+
let nodeList = parent.querySelectorAll(selector);
|
|
5826
|
+
if (nodeList.length) {
|
|
5827
|
+
return nodeList;
|
|
5792
5828
|
}
|
|
5793
5829
|
}
|
|
5794
|
-
}
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5830
|
+
}
|
|
5831
|
+
let nodeList = getNodeList();
|
|
5832
|
+
if (nodeList) {
|
|
5833
|
+
resolve(nodeList);
|
|
5834
|
+
return;
|
|
5835
|
+
}
|
|
5836
|
+
let observer = that.mutationObserver(parent, {
|
|
5837
|
+
config: {
|
|
5838
|
+
subtree: true,
|
|
5839
|
+
childList: true,
|
|
5840
|
+
attributes: true,
|
|
5841
|
+
},
|
|
5842
|
+
callback() {
|
|
5843
|
+
let node = getNodeList();
|
|
5844
|
+
if (node) {
|
|
5845
|
+
// 取消观察器
|
|
5846
|
+
observer.disconnect();
|
|
5847
|
+
resolve(node);
|
|
5802
5848
|
return;
|
|
5803
5849
|
}
|
|
5804
|
-
checkNodes(observer);
|
|
5805
5850
|
},
|
|
5806
5851
|
});
|
|
5852
|
+
if (timeout > 0) {
|
|
5853
|
+
setTimeout(() => {
|
|
5854
|
+
// 取消观察器
|
|
5855
|
+
observer.disconnect();
|
|
5856
|
+
resolve(null);
|
|
5857
|
+
}, timeout);
|
|
5858
|
+
}
|
|
5807
5859
|
});
|
|
5808
5860
|
}
|
|
5809
|
-
waitAnyNodeList(...
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5861
|
+
waitAnyNodeList(...args) {
|
|
5862
|
+
// 过滤掉undefined
|
|
5863
|
+
args = args.filter((arg) => arg !== void 0);
|
|
5864
|
+
let that = this;
|
|
5865
|
+
// 选择器数组
|
|
5866
|
+
let selectorList = args[0];
|
|
5867
|
+
// 父元素(监听的元素)
|
|
5868
|
+
let parent = UtilsCore.document;
|
|
5869
|
+
// 超时时间
|
|
5870
|
+
let timeout = 0;
|
|
5871
|
+
if (!Array.isArray(args[0])) {
|
|
5872
|
+
throw new TypeError("Utils.waitAnyNodeList 第一个参数必须是string[]");
|
|
5873
|
+
}
|
|
5874
|
+
if (args.length === 1) ;
|
|
5875
|
+
else if (args.length === 2) {
|
|
5876
|
+
let secondParam = args[1];
|
|
5877
|
+
if (typeof secondParam === "number") {
|
|
5878
|
+
// "div",10000
|
|
5879
|
+
timeout = secondParam;
|
|
5880
|
+
}
|
|
5881
|
+
else if (typeof secondParam === "object" &&
|
|
5882
|
+
secondParam instanceof Node) {
|
|
5883
|
+
// "div",document
|
|
5884
|
+
parent = secondParam;
|
|
5815
5885
|
}
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5886
|
+
else {
|
|
5887
|
+
throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是number|Node");
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5890
|
+
else if (args.length === 3) {
|
|
5891
|
+
// "div",document,10000
|
|
5892
|
+
// 第二个参数,parent
|
|
5893
|
+
let secondParam = args[1];
|
|
5894
|
+
// 第三个参数,timeout
|
|
5895
|
+
let thirdParam = args[2];
|
|
5896
|
+
if (typeof secondParam === "object" && secondParam instanceof Node) {
|
|
5897
|
+
parent = secondParam;
|
|
5898
|
+
if (typeof thirdParam === "number") {
|
|
5899
|
+
timeout = thirdParam;
|
|
5829
5900
|
}
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
observer?.disconnect();
|
|
5833
|
-
resolve(selectNodes);
|
|
5901
|
+
else {
|
|
5902
|
+
throw new TypeError("Utils.waitAnyNodeList 第三个参数必须是number");
|
|
5834
5903
|
}
|
|
5835
|
-
}
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
checkNodes(observer);
|
|
5846
|
-
},
|
|
5847
|
-
});
|
|
5904
|
+
}
|
|
5905
|
+
else {
|
|
5906
|
+
throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是Node");
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5909
|
+
else {
|
|
5910
|
+
throw new TypeError("Utils.waitAnyNodeList 参数个数错误");
|
|
5911
|
+
}
|
|
5912
|
+
let promiseList = selectorList.map((selector) => {
|
|
5913
|
+
return that.waitNodeList(selector, parent, timeout);
|
|
5848
5914
|
});
|
|
5915
|
+
return Promise.any(promiseList);
|
|
5849
5916
|
}
|
|
5850
5917
|
waitProperty(checkObj, checkPropertyName) {
|
|
5851
5918
|
return new Promise((resolve) => {
|