From 3032d9e6b90c4d43af51ce9d55930eb9a8624559 Mon Sep 17 00:00:00 2001 From: xjm Date: Wed, 17 Jul 2024 22:32:01 +0800 Subject: [PATCH] fix:doc --- deno.json | 2 +- libs/fetcher.ts | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/deno.json b/deno.json index e223209..c1678b8 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@advanced/fetcher", - "version": "1.0.0", + "version": "1.0.1", "exports": "./mod.ts", "publish": { "exclude": [ diff --git a/libs/fetcher.ts b/libs/fetcher.ts index ada2fe0..42d160d 100644 --- a/libs/fetcher.ts +++ b/libs/fetcher.ts @@ -141,7 +141,8 @@ export class Fetcher extends SyncEventDispatcher<{ return result } /** - * 如果options中存在那么会忽略body + * 请求核心方法 + * 其他所有具名方法均调用此方法 * @param url * @param options * @returns @@ -176,6 +177,9 @@ export class Fetcher extends SyncEventDispatcher<{ method: "GET", }); } + /** + * @alias Fetcher.get + */ public GET = this.get /** * 发起http method=post的请求 @@ -193,6 +197,9 @@ export class Fetcher extends SyncEventDispatcher<{ method: "POST", }); } + /** + * @alias Fetcher.post + */ public POST = this.post /** * method为 head的请求 @@ -207,9 +214,12 @@ export class Fetcher extends SyncEventDispatcher<{ method: 'HEAD', }) } + /** + * @alias Fetcher.head + */ public HEAD = this.head /** - * + * http method=options的请求 * @param url 相对config.baseURL 中的路径 * @param options * @returns @@ -225,7 +235,9 @@ export class Fetcher extends SyncEventDispatcher<{ }); } } - +/** + * createFetch的参数类型 + */ export type CreateFetcherOptions = FetherConfig & { baseURL?: string, requestInterceptor?: RequestInterceptor[] | RequestInterceptor;