minutool 1.0.11 → 1.0.13

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.d.ts CHANGED
@@ -344,11 +344,11 @@ declare interface Dimension {
344
344
  export declare const disabled: (el: HTMLElement | string, disabledClass?: string) => void;
345
345
 
346
346
  /**
347
- * 发布事件
348
- * @param {string} event 事件名称
347
+ * 发布事件,event 可以是字符串或 Symbol,detail 是事件详情
348
+ * @param {string | symbol} event 事件名称
349
349
  * @param {any} detail 事件详情
350
350
  */
351
- declare const dispatchEvent_2: (event: string, detail?: any) => void;
351
+ declare const dispatchEvent_2: (event: string | symbol, detail?: any) => void;
352
352
  export { dispatchEvent_2 as dispatchEvent }
353
353
 
354
354
  /**
@@ -1236,11 +1236,11 @@ export declare function objectSet(obj: any, path: string, value: any): void;
1236
1236
  export declare const objToQuery: (data: Record<string, any>) => string;
1237
1237
 
1238
1238
  /**
1239
- * 取消订阅事件
1240
- * @param {string} event 事件名称
1239
+ * 取消订阅事件,event 可以是字符串或 Symbol,handler 是事件处理函数
1240
+ * @param {string | symbol} event 事件名称
1241
1241
  * @param {Function} handler 事件处理函数
1242
1242
  */
1243
- export declare const offEvent: (event: string, handler: EventListenerOrEventListenerObject) => void;
1243
+ export declare const offEvent: (event: string | symbol, handler: EventListenerOrEventListenerObject) => void;
1244
1244
 
1245
1245
  /**
1246
1246
  * 监听节点树变更
@@ -1270,11 +1270,11 @@ export declare const ONE_YEAR365: number;
1270
1270
  export declare const ONE_YEAR366: number;
1271
1271
 
1272
1272
  /**
1273
- * 订阅事件
1274
- * @param {string} event 事件名称
1273
+ * 订阅事件,event 可以是字符串或 Symbol,handler 是事件处理函数
1274
+ * @param {string | symbol} event 事件名称
1275
1275
  * @param {Function} handler 事件处理函数
1276
1276
  */
1277
- export declare const onEvent: (event: string, handler: EventListenerOrEventListenerObject) => void;
1277
+ export declare const onEvent: (event: string | symbol, handler: EventListenerOrEventListenerObject) => void;
1278
1278
 
1279
1279
  export declare const onHover: (el: HTMLElement | string, onHoverIn: () => void, onHoverOut: () => void) => void;
1280
1280
 
@@ -1445,14 +1445,18 @@ export declare const remove: (dom: HTMLElement | string) => Node | null;
1445
1445
  * @param {string} url - 请求 URL
1446
1446
  * @param {BodyInit|null} [data=null] - 请求数据,可以是字符串、FormData、URLSearchParams、Blob、ArrayBuffer 等,如果是对象会根据 ContentType 自动转换(例如 application/json 会自动 JSON.stringify)
1447
1447
  * @param {RequestOption} option - 请求选项
1448
+ * @param {number} [option.timeout] - 请求超时时间(毫秒)
1449
+ * @param {number} [option.delay] - 延迟响应时间(毫秒),用于模拟慢速请求
1448
1450
  * @returns {AbortablePromise<Response>} 返回可中止的 Promise
1449
1451
  * @example
1450
1452
  * request('/api/data', null, {method: 'GET'})
1453
+ * request('/api/data', null, {method: 'GET', delay: 2000}) // 延迟 2 秒响应
1451
1454
  */
1452
1455
  export declare const request: (url: string, data: (BodyInit | null) | undefined, option: RequestOption) => AbortablePromise<Response>;
1453
1456
 
1454
1457
  declare interface RequestOption extends RequestInit {
1455
1458
  timeout?: number;
1459
+ delay?: number;
1456
1460
  [key: string]: any;
1457
1461
  }
1458
1462