Skip to content

Commit

Permalink
删除 load() 签名说明
Browse files Browse the repository at this point in the history
  • Loading branch information
vilicvane committed Nov 5, 2023
1 parent 7b12cd2 commit e204e16
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions docs/script/utils/load.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,3 @@ const data = await load('https://api.example.com/list', 'json');
// 获取流
const stream = await load('https://example.com/image.png');
```

## 签名

```ts
type LoadOptions = {
/**
* 尝试次数,默认为 3。
*/
attempts?: number;
/**
* 尝试间隔(毫秒),默认为 1000。
*/
attemptInterval?: number;
} & RequestInit;

type LoadType = 'text' | 'json' | 'blob' | 'arrayBuffer';

declare function load(
input: NodeJS.fetch.RequestInfo,
options?: LoadOptions,
): Promise<ReadableStream>;
declare function load<TType extends LoadType>(
input: NodeJS.fetch.RequestInfo,
type: TType,
options?: LoadOptions,
): Promise<Awaited<ReturnType<Response[TType]>>>;
```

0 comments on commit e204e16

Please sign in to comment.