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