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