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