Skip to content

Commit 5c8460d

Browse files
author
jarvisjiang
committed
update docs
1 parent 9e5c4ce commit 5c8460d

File tree

5 files changed

+96
-82
lines changed

5 files changed

+96
-82
lines changed

docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
## Interfaces
88

99
| Interface | Description |
10-
| :------ | :------ |
10+
| ------ | ------ |
1111
| [FetchInit](interfaces/FetchInit.md) | Extends the standard `RequestInit` interface from the Fetch API to include additional custom options. |
1212
| [FetchTask](interfaces/FetchTask.md) | Defines the structure and behavior of a fetch task, including the ability to abort the task and check its status. |
1313

1414
## Type Aliases
1515

1616
| Type alias | Description |
17-
| :------ | :------ |
17+
| ------ | ------ |
1818
| [FetchResponse](type-aliases/FetchResponse.md) | Represents the response of a fetch operation, encapsulating the result data or any error that occurred. |
1919

2020
## Functions
2121

2222
| Function | Description |
23-
| :------ | :------ |
23+
| ------ | ------ |
2424
| [fetchT](functions/fetchT.md) | Fetches a resource from the network as a text string and returns a `FetchTask` representing the operation. |

docs/functions/fetchT.md

Lines changed: 59 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66

77
# Function: fetchT()
88

9+
Fetches a resource from the network and returns either a `FetchTask` or `FetchResponse` based on the provided options.
10+
11+
## Type Param
12+
13+
The expected type of the response data when not using a specific `responseType`.
14+
15+
## Param
16+
17+
The resource to fetch. Can be a URL object or a string representing a URL.
18+
19+
## Param
20+
21+
Additional options for the fetch operation, including custom `FetchInit` properties.
22+
923
## fetchT(url, init)
1024

1125
```ts
@@ -17,7 +31,7 @@ Fetches a resource from the network as a text string and returns a `FetchTask` r
1731
### Parameters
1832

1933
| Parameter | Type | Description |
20-
| :------ | :------ | :------ |
34+
| ------ | ------ | ------ |
2135
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
2236
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `abortable`: `true`; `responseType`: `"text"`; \} | Additional options for the fetch operation, including custom `FetchInit` properties. |
2337

@@ -27,9 +41,9 @@ Fetches a resource from the network as a text string and returns a `FetchTask` r
2741

2842
A `FetchTask` representing the operation with a `string` response.
2943

30-
### Source
44+
### Defined in
3145

32-
[src/fetch/fetch.ts:14](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L14)
46+
[src/fetch/fetch.ts:14](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L14)
3347

3448
## fetchT(url, init)
3549

@@ -42,7 +56,7 @@ Fetches a resource from the network as an ArrayBuffer and returns a `FetchTask`
4256
### Parameters
4357

4458
| Parameter | Type | Description |
45-
| :------ | :------ | :------ |
59+
| ------ | ------ | ------ |
4660
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
4761
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `abortable`: `true`; `responseType`: `"arraybuffer"`; \} | Additional options for the fetch operation, including custom `FetchInit` properties. |
4862

@@ -52,9 +66,9 @@ Fetches a resource from the network as an ArrayBuffer and returns a `FetchTask`
5266

5367
A `FetchTask` representing the operation with an `ArrayBuffer` response.
5468

55-
### Source
69+
### Defined in
5670

57-
[src/fetch/fetch.ts:26](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L26)
71+
[src/fetch/fetch.ts:26](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L26)
5872

5973
## fetchT(url, init)
6074

@@ -67,7 +81,7 @@ Fetches a resource from the network as a Blob and returns a `FetchTask` represen
6781
### Parameters
6882

6983
| Parameter | Type | Description |
70-
| :------ | :------ | :------ |
84+
| ------ | ------ | ------ |
7185
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
7286
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `abortable`: `true`; `responseType`: `"blob"`; \} | Additional options for the fetch operation, including custom `FetchInit` properties. |
7387

@@ -77,9 +91,9 @@ Fetches a resource from the network as a Blob and returns a `FetchTask` represen
7791

7892
A `FetchTask` representing the operation with a `Blob` response.
7993

80-
### Source
94+
### Defined in
8195

82-
[src/fetch/fetch.ts:38](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L38)
96+
[src/fetch/fetch.ts:38](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L38)
8397

8498
## fetchT(url, init)
8599

@@ -89,16 +103,16 @@ function fetchT<T>(url, init): FetchTask<T>
89103

90104
Fetches a resource from the network and parses it as JSON, returning a `FetchTask` representing the operation.
91105

92-
### Type parameters
106+
### Type Parameters
93107

94-
| Type parameter | Description |
95-
| :------ | :------ |
108+
| Type Parameter | Description |
109+
| ------ | ------ |
96110
| `T` | The expected type of the parsed JSON data. |
97111

98112
### Parameters
99113

100114
| Parameter | Type | Description |
101-
| :------ | :------ | :------ |
115+
| ------ | ------ | ------ |
102116
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
103117
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `abortable`: `true`; `responseType`: `"json"`; \} | Additional options for the fetch operation, including custom `FetchInit` properties. |
104118

@@ -108,9 +122,9 @@ Fetches a resource from the network and parses it as JSON, returning a `FetchTas
108122

109123
A `FetchTask` representing the operation with a response parsed as JSON.
110124

111-
### Source
125+
### Defined in
112126

113-
[src/fetch/fetch.ts:51](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L51)
127+
[src/fetch/fetch.ts:51](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L51)
114128

115129
## fetchT(url, init)
116130

@@ -123,7 +137,7 @@ Fetches a resource from the network as a text string and returns a `FetchRespons
123137
### Parameters
124138

125139
| Parameter | Type | Description |
126-
| :------ | :------ | :------ |
140+
| ------ | ------ | ------ |
127141
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
128142
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `responseType`: `"text"`; \} | Additional options for the fetch operation, specifying the response type as 'text'. |
129143

@@ -133,9 +147,9 @@ Fetches a resource from the network as a text string and returns a `FetchRespons
133147

134148
A `FetchResponse` representing the operation with a `string` response.
135149

136-
### Source
150+
### Defined in
137151

138-
[src/fetch/fetch.ts:63](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L63)
152+
[src/fetch/fetch.ts:63](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L63)
139153

140154
## fetchT(url, init)
141155

@@ -148,7 +162,7 @@ Fetches a resource from the network as an ArrayBuffer and returns a `FetchRespon
148162
### Parameters
149163

150164
| Parameter | Type | Description |
151-
| :------ | :------ | :------ |
165+
| ------ | ------ | ------ |
152166
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
153167
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `responseType`: `"arraybuffer"`; \} | Additional options for the fetch operation, specifying the response type as 'arraybuffer'. |
154168

@@ -158,9 +172,9 @@ Fetches a resource from the network as an ArrayBuffer and returns a `FetchRespon
158172

159173
A `FetchResponse` representing the operation with an `ArrayBuffer` response.
160174

161-
### Source
175+
### Defined in
162176

163-
[src/fetch/fetch.ts:74](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L74)
177+
[src/fetch/fetch.ts:74](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L74)
164178

165179
## fetchT(url, init)
166180

@@ -173,7 +187,7 @@ Fetches a resource from the network as a Blob and returns a `FetchResponse` repr
173187
### Parameters
174188

175189
| Parameter | Type | Description |
176-
| :------ | :------ | :------ |
190+
| ------ | ------ | ------ |
177191
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
178192
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `responseType`: `"blob"`; \} | Additional options for the fetch operation, specifying the response type as 'blob'. |
179193

@@ -183,9 +197,9 @@ Fetches a resource from the network as a Blob and returns a `FetchResponse` repr
183197

184198
A `FetchResponse` representing the operation with a `Blob` response.
185199

186-
### Source
200+
### Defined in
187201

188-
[src/fetch/fetch.ts:85](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L85)
202+
[src/fetch/fetch.ts:85](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L85)
189203

190204
## fetchT(url, init)
191205

@@ -195,16 +209,16 @@ function fetchT<T>(url, init): FetchResponse<T>
195209

196210
Fetches a resource from the network and parses it as JSON, returning a `FetchResponse` representing the operation.
197211

198-
### Type parameters
212+
### Type Parameters
199213

200-
| Type parameter | Description |
201-
| :------ | :------ |
214+
| Type Parameter | Description |
215+
| ------ | ------ |
202216
| `T` | The expected type of the parsed JSON data. |
203217

204218
### Parameters
205219

206220
| Parameter | Type | Description |
207-
| :------ | :------ | :------ |
221+
| ------ | ------ | ------ |
208222
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
209223
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `responseType`: `"json"`; \} | Additional options for the fetch operation, specifying the response type as 'json'. |
210224

@@ -214,9 +228,9 @@ Fetches a resource from the network and parses it as JSON, returning a `FetchRes
214228

215229
A `FetchResponse` representing the operation with a response parsed as JSON.
216230

217-
### Source
231+
### Defined in
218232

219-
[src/fetch/fetch.ts:97](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L97)
233+
[src/fetch/fetch.ts:97](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L97)
220234

221235
## fetchT(url, init)
222236

@@ -229,7 +243,7 @@ Fetches a resource from the network and returns a `FetchTask` representing the o
229243
### Parameters
230244

231245
| Parameter | Type | Description |
232-
| :------ | :------ | :------ |
246+
| ------ | ------ | ------ |
233247
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
234248
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `abortable`: `true`; \} | Additional options for the fetch operation, indicating that the operation should be abortable. |
235249

@@ -239,9 +253,9 @@ Fetches a resource from the network and returns a `FetchTask` representing the o
239253

240254
A `FetchTask` representing the operation with a generic `Response`.
241255

242-
### Source
256+
### Defined in
243257

244-
[src/fetch/fetch.ts:108](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L108)
258+
[src/fetch/fetch.ts:108](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L108)
245259

246260
## fetchT(url, init)
247261

@@ -254,7 +268,7 @@ Fetches a resource from the network and returns a `FetchResponse` representing t
254268
### Parameters
255269

256270
| Parameter | Type | Description |
257-
| :------ | :------ | :------ |
271+
| ------ | ------ | ------ |
258272
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
259273
| `init` | [`FetchInit`](../interfaces/FetchInit.md) & \{ `abortable`: `false`; \} | Additional options for the fetch operation, indicating that the operation should not be abortable. |
260274

@@ -264,9 +278,9 @@ Fetches a resource from the network and returns a `FetchResponse` representing t
264278

265279
A `FetchResponse` representing the operation with a generic `Response`.
266280

267-
### Source
281+
### Defined in
268282

269-
[src/fetch/fetch.ts:119](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L119)
283+
[src/fetch/fetch.ts:119](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L119)
270284

271285
## fetchT(url, init)
272286

@@ -276,16 +290,16 @@ function fetchT<T>(url, init): FetchTask<T> | FetchResponse<T>
276290

277291
Fetches a resource from the network and returns a `FetchResponse` or `FetchTask` based on the provided options.
278292

279-
### Type parameters
293+
### Type Parameters
280294

281-
| Type parameter | Description |
282-
| :------ | :------ |
295+
| Type Parameter | Description |
296+
| ------ | ------ |
283297
| `T` | The expected type of the response data when not using a specific `responseType`. |
284298

285299
### Parameters
286300

287301
| Parameter | Type | Description |
288-
| :------ | :------ | :------ |
302+
| ------ | ------ | ------ |
289303
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
290304
| `init` | [`FetchInit`](../interfaces/FetchInit.md) | Additional options for the fetch operation, including custom `FetchInit` properties. |
291305

@@ -295,9 +309,9 @@ Fetches a resource from the network and returns a `FetchResponse` or `FetchTask`
295309

296310
A `FetchResponse` or `FetchTask` depending on the `abortable` option in `init`.
297311

298-
### Source
312+
### Defined in
299313

300-
[src/fetch/fetch.ts:131](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L131)
314+
[src/fetch/fetch.ts:131](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L131)
301315

302316
## fetchT(url, init)
303317

@@ -310,7 +324,7 @@ Fetches a resource from the network and returns a `FetchResponse` representing t
310324
### Parameters
311325

312326
| Parameter | Type | Description |
313-
| :------ | :------ | :------ |
327+
| ------ | ------ | ------ |
314328
| `url` | `string` \| `URL` | The resource to fetch. Can be a URL object or a string representing a URL. |
315329
| `init`? | `RequestInit` | Standard `RequestInit` options for the fetch operation. |
316330

@@ -320,6 +334,6 @@ Fetches a resource from the network and returns a `FetchResponse` representing t
320334

321335
A `FetchResponse` representing the operation with a `Response` object.
322336

323-
### Source
337+
### Defined in
324338

325-
[src/fetch/fetch.ts:140](https://github.com/JiangJie/fetch-t/blob/6a5239d36df6ec2fbc78b194fa1370d9bdc8caa2/src/fetch/fetch.ts#L140)
339+
[src/fetch/fetch.ts:140](https://github.com/JiangJie/fetch-t/blob/9e5c4ce034f7bf6add07f55044bccbb16a68960c/src/fetch/fetch.ts#L140)

0 commit comments

Comments
 (0)