@whitesev/utils 1.2.1 → 1.2.2

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.
@@ -1529,6 +1529,25 @@ declare class Utils {
1529
1529
  * })
1530
1530
  */
1531
1531
  waitNodeList<T extends HTMLElement>(nodeSelector: string): Promise<T>;
1532
+ /**
1533
+ * 等待指定元素出现
1534
+ * @param nodeSelectors
1535
+ * @returns 当nodeSelectors为数组多个时,
1536
+ * 返回如:[ NodeList, NodeList ],
1537
+ * 当nodeSelectors为单个时,
1538
+ * 返回如:NodeList。
1539
+ * NodeList元素与页面存在强绑定,当已获取该NodeList,但是页面中却删除了,该元素在NodeList中会被自动删除
1540
+ * @example
1541
+ * Utils.waitNodeList("div.xxx").then( nodeList =>{
1542
+ * console.log(nodeList) // div.xxx => NodeList
1543
+ * })
1544
+ * @example
1545
+ * Utils.waitNodeList("div.xxx","a.xxx").then( nodeListArray =>{
1546
+ * console.log(nodeListArray[0]) // div.xxx => NodeList
1547
+ * console.log(nodeListArray[1]) // a.xxx => NodeList
1548
+ * })
1549
+ */
1550
+ waitNodeList<T extends HTMLElement[]>(nodeSelector: string): Promise<T>;
1532
1551
  /**
1533
1552
  * 等待指定元素出现,支持多个selector
1534
1553
  * @param nodeSelectors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "一个常用的工具库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/node/index.esm.js",
package/src/Utils.ts CHANGED
@@ -4179,6 +4179,25 @@ class Utils {
4179
4179
  * })
4180
4180
  */
4181
4181
  waitNodeList<T extends HTMLElement>(nodeSelector: string): Promise<T>;
4182
+ /**
4183
+ * 等待指定元素出现
4184
+ * @param nodeSelectors
4185
+ * @returns 当nodeSelectors为数组多个时,
4186
+ * 返回如:[ NodeList, NodeList ],
4187
+ * 当nodeSelectors为单个时,
4188
+ * 返回如:NodeList。
4189
+ * NodeList元素与页面存在强绑定,当已获取该NodeList,但是页面中却删除了,该元素在NodeList中会被自动删除
4190
+ * @example
4191
+ * Utils.waitNodeList("div.xxx").then( nodeList =>{
4192
+ * console.log(nodeList) // div.xxx => NodeList
4193
+ * })
4194
+ * @example
4195
+ * Utils.waitNodeList("div.xxx","a.xxx").then( nodeListArray =>{
4196
+ * console.log(nodeListArray[0]) // div.xxx => NodeList
4197
+ * console.log(nodeListArray[1]) // a.xxx => NodeList
4198
+ * })
4199
+ */
4200
+ waitNodeList<T extends HTMLElement[]>(nodeSelector: string): Promise<T>;
4182
4201
  /**
4183
4202
  * 等待指定元素出现,支持多个selector
4184
4203
  * @param nodeSelectors