@route-forge/core 1.0.2 → 1.1.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.
@@ -130,6 +130,8 @@ interface RequestConfig {
130
130
  timeout?: number;
131
131
  /** 自定义 query 序列化函数 */
132
132
  paramsSerializer?: (params: Record<string, unknown>) => string;
133
+ /** 请求取消信号(AbortSignal),用于取消已发出的请求 */
134
+ signal?: AbortSignal;
133
135
  }
134
136
  /**
135
137
  * 响应拦截器首段接收的完整数据对象
@@ -180,6 +182,14 @@ interface ApiCallParams {
180
182
  * 单次请求超时覆盖(毫秒);不传时使用 createRouteForge({ timeout }) 全局值
181
183
  */
182
184
  timeout?: number;
185
+ /**
186
+ * 请求取消信号(AbortSignal);调用 AbortController.abort() 即可取消请求
187
+ * @example
188
+ * const controller = new AbortController();
189
+ * forge.api('admin', 'users.index', { signal: controller.signal });
190
+ * controller.abort(); // 取消请求
191
+ */
192
+ signal?: AbortSignal;
183
193
  }
184
194
  /**
185
195
  * 缓存存储介质
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@route-forge/core",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "框架无关的命名路由客户端核心:分级懒加载、隔离缓存、并发去重、拦截器",
5
5
  "license": "MIT",
6
6
  "author": "阿杰很厉害 <506907958@qq.com>",