@capacitor/core 6.0.0-rc.0 → 6.0.0-rc.2

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/cookies.md ADDED
@@ -0,0 +1,250 @@
1
+ # CapacitorCookies
2
+
3
+ The Capacitor Cookies API provides native cookie support via patching `document.cookie` to use native libraries. It also provides methods for modifying cookies at a specific url. This plugin is bundled with `@capacitor/core`.
4
+
5
+ ## Configuration
6
+
7
+ By default, the patching of `document.cookie` to use native libraries is disabled.
8
+ If you would like to enable this feature, modify the configuration below in the `capacitor.config` file.
9
+
10
+ | Prop | Type | Description | Default |
11
+ | ------------- | -------------------- | ------------------------------------------------------------------------- | ------------------ |
12
+ | **`enabled`** | <code>boolean</code> | Enable the patching of `document.cookie` to use native libraries instead. | <code>false</code> |
13
+
14
+ ### Example Configuration
15
+
16
+ In `capacitor.config.json`:
17
+
18
+ ```json
19
+ {
20
+ "plugins": {
21
+ "CapacitorCookies": {
22
+ "enabled": true
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ In `capacitor.config.ts`:
29
+
30
+ ```ts
31
+ import { CapacitorConfig } from '@capacitor/cli';
32
+
33
+ const config: CapacitorConfig = {
34
+ plugins: {
35
+ CapacitorCookies: {
36
+ enabled: true,
37
+ },
38
+ },
39
+ };
40
+
41
+ export default config;
42
+ ```
43
+
44
+ ## Example
45
+
46
+ ```typescript
47
+ import { CapacitorCookies } from '@capacitor/core';
48
+
49
+ const getCookies = () => {
50
+ return document.cookie;
51
+ };
52
+
53
+ const setCookie = () => {
54
+ document.cookie = key + '=' + value;
55
+ };
56
+
57
+ const setCapacitorCookie = async () => {
58
+ await CapacitorCookies.setCookie({
59
+ url: 'http://example.com',
60
+ key: 'language',
61
+ value: 'en',
62
+ });
63
+ };
64
+
65
+ const deleteCookie = async () => {
66
+ await CapacitorCookies.deleteCookie({
67
+ url: 'https://example.com',
68
+ key: 'language',
69
+ });
70
+ };
71
+
72
+ const clearCookiesOnUrl = async () => {
73
+ await CapacitorCookies.clearCookies({
74
+ url: 'https://example.com',
75
+ });
76
+ };
77
+
78
+ const clearAllCookies = async () => {
79
+ await CapacitorCookies.clearAllCookies();
80
+ };
81
+ ```
82
+
83
+ ## Third Party Cookies on iOS
84
+
85
+ As of iOS 14, you cannot use 3rd party cookies by default. Add the following lines to your Info.plist file to get better support for cookies on iOS. You can add up to 10 domains.
86
+
87
+ ```xml
88
+ <key>WKAppBoundDomains</key>
89
+ <array>
90
+ <string>www.mydomain.com</string>
91
+ <string>api.mydomain.com</string>
92
+ <string>www.myothercooldomain.com</string>
93
+ </array>
94
+ ```
95
+
96
+ ## API
97
+
98
+ <docgen-index>
99
+
100
+ * [`getCookies(...)`](#getcookies)
101
+ * [`setCookie(...)`](#setcookie)
102
+ * [`deleteCookie(...)`](#deletecookie)
103
+ * [`clearCookies(...)`](#clearcookies)
104
+ * [`clearAllCookies()`](#clearallcookies)
105
+ * [Interfaces](#interfaces)
106
+ * [Type Aliases](#type-aliases)
107
+
108
+ </docgen-index>
109
+
110
+ <docgen-api>
111
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
112
+
113
+ ### getCookies(...)
114
+
115
+ ```typescript
116
+ getCookies(options?: GetCookieOptions) => Promise<HttpCookieMap>
117
+ ```
118
+
119
+ | Param | Type |
120
+ | ------------- | ------------------------------------------------------------- |
121
+ | **`options`** | <code><a href="#getcookieoptions">GetCookieOptions</a></code> |
122
+
123
+ **Returns:** <code>Promise&lt;<a href="#httpcookiemap">HttpCookieMap</a>&gt;</code>
124
+
125
+ --------------------
126
+
127
+
128
+ ### setCookie(...)
129
+
130
+ ```typescript
131
+ setCookie(options: SetCookieOptions) => Promise<void>
132
+ ```
133
+
134
+ Write a cookie to the device.
135
+
136
+ | Param | Type |
137
+ | ------------- | ------------------------------------------------------------- |
138
+ | **`options`** | <code><a href="#setcookieoptions">SetCookieOptions</a></code> |
139
+
140
+ --------------------
141
+
142
+
143
+ ### deleteCookie(...)
144
+
145
+ ```typescript
146
+ deleteCookie(options: DeleteCookieOptions) => Promise<void>
147
+ ```
148
+
149
+ Delete a cookie from the device.
150
+
151
+ | Param | Type |
152
+ | ------------- | ------------------------------------------------------------------- |
153
+ | **`options`** | <code><a href="#deletecookieoptions">DeleteCookieOptions</a></code> |
154
+
155
+ --------------------
156
+
157
+
158
+ ### clearCookies(...)
159
+
160
+ ```typescript
161
+ clearCookies(options: ClearCookieOptions) => Promise<void>
162
+ ```
163
+
164
+ Clear cookies from the device at a given URL.
165
+
166
+ | Param | Type |
167
+ | ------------- | ----------------------------------------------------------------- |
168
+ | **`options`** | <code><a href="#clearcookieoptions">ClearCookieOptions</a></code> |
169
+
170
+ --------------------
171
+
172
+
173
+ ### clearAllCookies()
174
+
175
+ ```typescript
176
+ clearAllCookies() => Promise<void>
177
+ ```
178
+
179
+ Clear all cookies on the device.
180
+
181
+ --------------------
182
+
183
+
184
+ ### Interfaces
185
+
186
+
187
+ #### HttpCookieMap
188
+
189
+
190
+ #### HttpCookie
191
+
192
+ | Prop | Type | Description |
193
+ | ----------- | ------------------- | ------------------------ |
194
+ | **`url`** | <code>string</code> | The URL of the cookie. |
195
+ | **`key`** | <code>string</code> | The key of the cookie. |
196
+ | **`value`** | <code>string</code> | The value of the cookie. |
197
+
198
+
199
+ #### HttpCookieExtras
200
+
201
+ | Prop | Type | Description |
202
+ | ------------- | ------------------- | -------------------------------- |
203
+ | **`path`** | <code>string</code> | The path to write the cookie to. |
204
+ | **`expires`** | <code>string</code> | The date to expire the cookie. |
205
+
206
+
207
+ ### Type Aliases
208
+
209
+
210
+ #### GetCookieOptions
211
+
212
+ <code><a href="#omit">Omit</a>&lt;<a href="#httpcookie">HttpCookie</a>, 'key' | 'value'&gt;</code>
213
+
214
+
215
+ #### Omit
216
+
217
+ Construct a type with the properties of T except for those in type K.
218
+
219
+ <code><a href="#pick">Pick</a>&lt;T, <a href="#exclude">Exclude</a>&lt;keyof T, K&gt;&gt;</code>
220
+
221
+
222
+ #### Pick
223
+
224
+ From T, pick a set of properties whose keys are in the union K
225
+
226
+ <code>{
227
  [P in K]: T[P];
1
228
  }</code>
229
+
230
+
231
+ #### Exclude
232
+
233
+ <a href="#exclude">Exclude</a> from T those types that are assignable to U
234
+
235
+ <code>T extends U ? never : T</code>
236
+
237
+
238
+ #### SetCookieOptions
239
+
240
+ <code><a href="#httpcookie">HttpCookie</a> & <a href="#httpcookieextras">HttpCookieExtras</a></code>
241
+
242
+
243
+ #### DeleteCookieOptions
244
+
245
+ <code><a href="#omit">Omit</a>&lt;<a href="#httpcookie">HttpCookie</a>, 'value'&gt;</code>
246
+
247
+
248
+ #### ClearCookieOptions
249
+
250
+ <code><a href="#omit">Omit</a>&lt;<a href="#httpcookie">HttpCookie</a>, 'key' | 'value'&gt;</code>
251
+
252
+ </docgen-api>
package/http.md ADDED
@@ -0,0 +1,683 @@
1
+ # CapacitorHttp
2
+
3
+ The Capacitor Http API provides native http support via patching `fetch` and `XMLHttpRequest` to use native libraries. It also provides helper methods for native http requests without the use of `fetch` and `XMLHttpRequest`. This plugin is bundled with `@capacitor/core`.
4
+
5
+ ## Configuration
6
+
7
+ By default, the patching of `window.fetch` and `XMLHttpRequest` to use native libraries is disabled.
8
+ If you would like to enable this feature, modify the configuration below in the `capacitor.config` file.
9
+
10
+ | Prop | Type | Description | Default |
11
+ | ------------- | -------------------- | ------------------------------------------------------------------------------------ | ------------------ |
12
+ | **`enabled`** | <code>boolean</code> | Enable the patching of `fetch` and `XMLHttpRequest` to use native libraries instead. | <code>false</code> |
13
+
14
+ ### Example Configuration
15
+
16
+ In `capacitor.config.json`:
17
+
18
+ ```json
19
+ {
20
+ "plugins": {
21
+ "CapacitorHttp": {
22
+ "enabled": true
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ In `capacitor.config.ts`:
29
+
30
+ ```ts
31
+ import { CapacitorConfig } from '@capacitor/cli';
32
+
33
+ const config: CapacitorConfig = {
34
+ plugins: {
35
+ CapacitorHttp: {
36
+ enabled: true,
37
+ },
38
+ },
39
+ };
40
+
41
+ export default config;
42
+ ```
43
+
44
+ ## Example
45
+
46
+ ```typescript
47
+ import { CapacitorHttp } from '@capacitor/core';
48
+
49
+ // Example of a GET request
50
+ const doGet = () => {
51
+ const options = {
52
+ url: 'https://example.com/my/api',
53
+ headers: { 'X-Fake-Header': 'Fake-Value' },
54
+ params: { size: 'XL' },
55
+ };
56
+
57
+ const response: HttpResponse = await CapacitorHttp.get(options);
58
+
59
+ // or...
60
+ // const response = await CapacitorHttp.request({ ...options, method: 'GET' })
61
+ };
62
+
63
+ // Example of a POST request. Note: data
64
+ // can be passed as a raw JS Object (must be JSON serializable)
65
+ const doPost = () => {
66
+ const options = {
67
+ url: 'https://example.com/my/api',
68
+ headers: { 'X-Fake-Header': 'Fake-Value' },
69
+ data: { foo: 'bar' },
70
+ };
71
+
72
+ const response: HttpResponse = await CapacitorHttp.post(options);
73
+
74
+ // or...
75
+ // const response = await CapacitorHttp.request({ ...options, method: 'POST' })
76
+ };
77
+ ```
78
+
79
+ ## Large File Support
80
+
81
+ Due to the nature of the bridge, parsing and transferring large amount of data from native to the web can cause issues. Support for downloading and uploading files to the native device is planned to be added to the `@capacitor/filesystem` plugin in the near future. One way to potentially circumvent the issue of running out of memory in the meantime (specifically on Android) is to edit the `AndroidManifest.xml` and add `android:largeHeap="true"` to the `application` element. Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory.
82
+
83
+ ## API
84
+
85
+ <docgen-index>
86
+
87
+ * [`request(...)`](#request)
88
+ * [`get(...)`](#get)
89
+ * [`post(...)`](#post)
90
+ * [`put(...)`](#put)
91
+ * [`patch(...)`](#patch)
92
+ * [`delete(...)`](#delete)
93
+ * [Interfaces](#interfaces)
94
+ * [Type Aliases](#type-aliases)
95
+
96
+ </docgen-index>
97
+
98
+ <docgen-api>
99
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
100
+
101
+ ****** HTTP PLUGIN *******
102
+
103
+ ### request(...)
104
+
105
+ ```typescript
106
+ request(options: HttpOptions) => Promise<HttpResponse>
107
+ ```
108
+
109
+ Make a Http Request to a server using native libraries.
110
+
111
+ | Param | Type |
112
+ | ------------- | --------------------------------------------------- |
113
+ | **`options`** | <code><a href="#httpoptions">HttpOptions</a></code> |
114
+
115
+ **Returns:** <code>Promise&lt;<a href="#httpresponse">HttpResponse</a>&gt;</code>
116
+
117
+ --------------------
118
+
119
+
120
+ ### get(...)
121
+
122
+ ```typescript
123
+ get(options: HttpOptions) => Promise<HttpResponse>
124
+ ```
125
+
126
+ Make a Http GET Request to a server using native libraries.
127
+
128
+ | Param | Type |
129
+ | ------------- | --------------------------------------------------- |
130
+ | **`options`** | <code><a href="#httpoptions">HttpOptions</a></code> |
131
+
132
+ **Returns:** <code>Promise&lt;<a href="#httpresponse">HttpResponse</a>&gt;</code>
133
+
134
+ --------------------
135
+
136
+
137
+ ### post(...)
138
+
139
+ ```typescript
140
+ post(options: HttpOptions) => Promise<HttpResponse>
141
+ ```
142
+
143
+ Make a Http POST Request to a server using native libraries.
144
+
145
+ | Param | Type |
146
+ | ------------- | --------------------------------------------------- |
147
+ | **`options`** | <code><a href="#httpoptions">HttpOptions</a></code> |
148
+
149
+ **Returns:** <code>Promise&lt;<a href="#httpresponse">HttpResponse</a>&gt;</code>
150
+
151
+ --------------------
152
+
153
+
154
+ ### put(...)
155
+
156
+ ```typescript
157
+ put(options: HttpOptions) => Promise<HttpResponse>
158
+ ```
159
+
160
+ Make a Http PUT Request to a server using native libraries.
161
+
162
+ | Param | Type |
163
+ | ------------- | --------------------------------------------------- |
164
+ | **`options`** | <code><a href="#httpoptions">HttpOptions</a></code> |
165
+
166
+ **Returns:** <code>Promise&lt;<a href="#httpresponse">HttpResponse</a>&gt;</code>
167
+
168
+ --------------------
169
+
170
+
171
+ ### patch(...)
172
+
173
+ ```typescript
174
+ patch(options: HttpOptions) => Promise<HttpResponse>
175
+ ```
176
+
177
+ Make a Http PATCH Request to a server using native libraries.
178
+
179
+ | Param | Type |
180
+ | ------------- | --------------------------------------------------- |
181
+ | **`options`** | <code><a href="#httpoptions">HttpOptions</a></code> |
182
+
183
+ **Returns:** <code>Promise&lt;<a href="#httpresponse">HttpResponse</a>&gt;</code>
184
+
185
+ --------------------
186
+
187
+
188
+ ### delete(...)
189
+
190
+ ```typescript
191
+ delete(options: HttpOptions) => Promise<HttpResponse>
192
+ ```
193
+
194
+ Make a Http DELETE Request to a server using native libraries.
195
+
196
+ | Param | Type |
197
+ | ------------- | --------------------------------------------------- |
198
+ | **`options`** | <code><a href="#httpoptions">HttpOptions</a></code> |
199
+
200
+ **Returns:** <code>Promise&lt;<a href="#httpresponse">HttpResponse</a>&gt;</code>
201
+
202
+ --------------------
203
+
204
+
205
+ ### Interfaces
206
+
207
+
208
+ #### HttpResponse
209
+
210
+ | Prop | Type | Description |
211
+ | ------------- | --------------------------------------------------- | ------------------------------------------------- |
212
+ | **`data`** | <code>any</code> | Additional data received with the Http response. |
213
+ | **`status`** | <code>number</code> | The status code received from the Http response. |
214
+ | **`headers`** | <code><a href="#httpheaders">HttpHeaders</a></code> | The headers received from the Http response. |
215
+ | **`url`** | <code>string</code> | The response URL recieved from the Http response. |
216
+
217
+
218
+ #### HttpHeaders
219
+
220
+
221
+ #### HttpOptions
222
+
223
+ | Prop | Type | Description |
224
+ | --------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
225
+ | **`url`** | <code>string</code> | The URL to send the request to. |
226
+ | **`method`** | <code>string</code> | The Http Request method to run. (Default is GET) |
227
+ | **`params`** | <code><a href="#httpparams">HttpParams</a></code> | URL parameters to append to the request. |
228
+ | **`data`** | <code>any</code> | Note: On Android and iOS, data can only be a string or a JSON. FormData, <a href="#blob">Blob</a>, <a href="#arraybuffer">ArrayBuffer</a>, and other complex types are only directly supported on web or through enabling `CapacitorHttp` in the config and using the patched `window.fetch` or `XMLHttpRequest`. If you need to send a complex type, you should serialize the data to base64 and set the `headers["Content-Type"]` and `dataType` attributes accordingly. |
229
+ | **`headers`** | <code><a href="#httpheaders">HttpHeaders</a></code> | Http Request headers to send with the request. |
230
+ | **`readTimeout`** | <code>number</code> | How long to wait to read additional data in milliseconds. Resets each time new data is received. |
231
+ | **`connectTimeout`** | <code>number</code> | How long to wait for the initial connection in milliseconds. |
232
+ | **`disableRedirects`** | <code>boolean</code> | Sets whether automatic HTTP redirects should be disabled |
233
+ | **`webFetchExtra`** | <code><a href="#requestinit">RequestInit</a></code> | Extra arguments for fetch when running on the web |
234
+ | **`responseType`** | <code><a href="#httpresponsetype">HttpResponseType</a></code> | This is used to parse the response appropriately before returning it to the requestee. If the response content-type is "json", this value is ignored. |
235
+ | **`shouldEncodeUrlParams`** | <code>boolean</code> | Use this option if you need to keep the URL unencoded in certain cases (already encoded, azure/firebase testing, etc.). The default is _true_. |
236
+ | **`dataType`** | <code>'file' \| 'formData'</code> | This is used if we've had to convert the data from a JS type that needs special handling in the native layer |
237
+
238
+
239
+ #### HttpParams
240
+
241
+
242
+ #### RequestInit
243
+
244
+ | Prop | Type | Description |
245
+ | -------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
246
+ | **`body`** | <code><a href="#bodyinit">BodyInit</a></code> | A <a href="#bodyinit">BodyInit</a> object or null to set request's body. |
247
+ | **`cache`** | <code><a href="#requestcache">RequestCache</a></code> | A string indicating how the request will interact with the browser's cache to set request's cache. |
248
+ | **`credentials`** | <code><a href="#requestcredentials">RequestCredentials</a></code> | A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. |
249
+ | **`headers`** | <code><a href="#headersinit">HeadersInit</a></code> | A <a href="#headers">Headers</a> object, an object literal, or an array of two-item arrays to set request's headers. |
250
+ | **`integrity`** | <code>string</code> | A cryptographic hash of the resource to be fetched by request. Sets request's integrity. |
251
+ | **`keepalive`** | <code>boolean</code> | A boolean to set request's keepalive. |
252
+ | **`method`** | <code>string</code> | A string to set request's method. |
253
+ | **`mode`** | <code><a href="#requestmode">RequestMode</a></code> | A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. |
254
+ | **`redirect`** | <code><a href="#requestredirect">RequestRedirect</a></code> | A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. |
255
+ | **`referrer`** | <code>string</code> | A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. |
256
+ | **`referrerPolicy`** | <code><a href="#referrerpolicy">ReferrerPolicy</a></code> | A referrer policy to set request's referrerPolicy. |
257
+ | **`signal`** | <code><a href="#abortsignal">AbortSignal</a></code> | An <a href="#abortsignal">AbortSignal</a> to set request's signal. |
258
+ | **`window`** | <code>any</code> | Can only be null. Used to disassociate request from any Window. |
259
+
260
+
261
+ #### Blob
262
+
263
+ A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The <a href="#file">File</a> interface is based on <a href="#blob">Blob</a>, inheriting blob functionality and expanding it to support files on the user's system.
264
+ `Blob` class is a global reference for `require('node:buffer').Blob`
265
+ https://nodejs.org/api/buffer.html#class-blob
266
+
267
+ | Prop | Type |
268
+ | ---------- | ------------------- |
269
+ | **`size`** | <code>number</code> |
270
+ | **`type`** | <code>string</code> |
271
+
272
+ | Method | Signature |
273
+ | --------------- | ----------------------------------------------------------------------------------- |
274
+ | **arrayBuffer** | () =&gt; Promise&lt;<a href="#arraybuffer">ArrayBuffer</a>&gt; |
275
+ | **slice** | (start?: number, end?: number, contentType?: string) =&gt; <a href="#blob">Blob</a> |
276
+ | **stream** | () =&gt; <a href="#readablestream">ReadableStream</a> |
277
+ | **text** | () =&gt; Promise&lt;string&gt; |
278
+
279
+
280
+ #### ArrayBuffer
281
+
282
+ Represents a raw buffer of binary data, which is used to store data for the
283
+ different typed arrays. ArrayBuffers cannot be read from or written to directly,
284
+ but can be passed to a typed array or DataView Object to interpret the raw
285
+ buffer as needed.
286
+
287
+ | Prop | Type | Description |
288
+ | ---------------- | ------------------- | ------------------------------------------------------------------------------- |
289
+ | **`byteLength`** | <code>number</code> | Read-only. The length of the <a href="#arraybuffer">ArrayBuffer</a> (in bytes). |
290
+
291
+ | Method | Signature | Description |
292
+ | --------- | -------------------------------------------------------------------------- | --------------------------------------------------------------- |
293
+ | **slice** | (begin: number, end?: number) =&gt; <a href="#arraybuffer">ArrayBuffer</a> | Returns a section of an <a href="#arraybuffer">ArrayBuffer</a>. |
294
+
295
+
296
+ #### ReadableStream
297
+
298
+ This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a <a href="#readablestream">ReadableStream</a> through the body property of a Response object.
299
+
300
+ | Prop | Type |
301
+ | ------------ | -------------------- |
302
+ | **`locked`** | <code>boolean</code> |
303
+
304
+ | Method | Signature |
305
+ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
306
+ | **cancel** | (reason?: any) =&gt; Promise&lt;void&gt; |
307
+ | **getReader** | () =&gt; <a href="#readablestreamdefaultreader">ReadableStreamDefaultReader</a>&lt;R&gt; |
308
+ | **pipeThrough** | &lt;T&gt;(transform: <a href="#readablewritablepair">ReadableWritablePair</a>&lt;T, R&gt;, options?: <a href="#streampipeoptions">StreamPipeOptions</a>) =&gt; <a href="#readablestream">ReadableStream</a>&lt;T&gt; |
309
+ | **pipeTo** | (dest: <a href="#writablestream">WritableStream</a>&lt;R&gt;, options?: <a href="#streampipeoptions">StreamPipeOptions</a>) =&gt; Promise&lt;void&gt; |
310
+ | **tee** | () =&gt; [ReadableStream&lt;R&gt;, <a href="#readablestream">ReadableStream</a>&lt;R&gt;] |
311
+
312
+
313
+ #### ReadableStreamDefaultReader
314
+
315
+ | Method | Signature |
316
+ | --------------- | --------------------------------------------------------------------------------------------------------------- |
317
+ | **read** | () =&gt; Promise&lt;<a href="#readablestreamdefaultreadresult">ReadableStreamDefaultReadResult</a>&lt;R&gt;&gt; |
318
+ | **releaseLock** | () =&gt; void |
319
+
320
+
321
+ #### ReadableStreamDefaultReadValueResult
322
+
323
+ | Prop | Type |
324
+ | ----------- | ------------------ |
325
+ | **`done`** | <code>false</code> |
326
+ | **`value`** | <code>T</code> |
327
+
328
+
329
+ #### ReadableStreamDefaultReadDoneResult
330
+
331
+ | Prop | Type |
332
+ | ----------- | ----------------- |
333
+ | **`done`** | <code>true</code> |
334
+ | **`value`** | |
335
+
336
+
337
+ #### ReadableWritablePair
338
+
339
+ | Prop | Type | Description |
340
+ | -------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
341
+ | **`readable`** | <code><a href="#readablestream">ReadableStream</a>&lt;R&gt;</code> | |
342
+ | **`writable`** | <code><a href="#writablestream">WritableStream</a>&lt;W&gt;</code> | Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. |
343
+
344
+
345
+ #### WritableStream
346
+
347
+ This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
348
+
349
+ | Prop | Type |
350
+ | ------------ | -------------------- |
351
+ | **`locked`** | <code>boolean</code> |
352
+
353
+ | Method | Signature |
354
+ | ------------- | ---------------------------------------------------------------------------------------- |
355
+ | **abort** | (reason?: any) =&gt; Promise&lt;void&gt; |
356
+ | **getWriter** | () =&gt; <a href="#writablestreamdefaultwriter">WritableStreamDefaultWriter</a>&lt;W&gt; |
357
+
358
+
359
+ #### WritableStreamDefaultWriter
360
+
361
+ This Streams API interface is the object returned by <a href="#writablestream">WritableStream.getWriter</a>() and once created locks the &lt; writer to the <a href="#writablestream">WritableStream</a> ensuring that no other streams can write to the underlying sink.
362
+
363
+ | Prop | Type |
364
+ | ----------------- | ------------------------------------- |
365
+ | **`closed`** | <code>Promise&lt;undefined&gt;</code> |
366
+ | **`desiredSize`** | <code>number</code> |
367
+ | **`ready`** | <code>Promise&lt;undefined&gt;</code> |
368
+
369
+ | Method | Signature |
370
+ | --------------- | ---------------------------------------- |
371
+ | **abort** | (reason?: any) =&gt; Promise&lt;void&gt; |
372
+ | **close** | () =&gt; Promise&lt;void&gt; |
373
+ | **releaseLock** | () =&gt; void |
374
+ | **write** | (chunk: W) =&gt; Promise&lt;void&gt; |
375
+
376
+
377
+ #### StreamPipeOptions
378
+
379
+ | Prop | Type | Description |
380
+ | ------------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
381
+ | **`preventAbort`** | <code>boolean</code> | |
382
+ | **`preventCancel`** | <code>boolean</code> | |
383
+ | **`preventClose`** | <code>boolean</code> | Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. Errors and closures of the source and destination streams propagate as follows: An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. The signal option can be set to an <a href="#abortsignal">AbortSignal</a> to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. |
384
+ | **`signal`** | <code><a href="#abortsignal">AbortSignal</a></code> | |
385
+
386
+
387
+ #### AbortSignal
388
+
389
+ A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
390
+
391
+ | Prop | Type | Description |
392
+ | ------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
393
+ | **`aborted`** | <code>boolean</code> | Returns true if this <a href="#abortsignal">AbortSignal</a>'s AbortController has signaled to abort, and false otherwise. |
394
+ | **`onabort`** | <code>(this: <a href="#abortsignal">AbortSignal</a>, ev: <a href="#event">Event</a>) =&gt; any</code> | |
395
+
396
+ | Method | Signature | Description |
397
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
398
+ | **addEventListener** | &lt;K extends "abort"&gt;(type: K, listener: (this: <a href="#abortsignal">AbortSignal</a>, ev: AbortSignalEventMap[K]) =&gt; any, options?: boolean \| <a href="#addeventlisteneroptions">AddEventListenerOptions</a>) =&gt; void | Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. |
399
+ | **addEventListener** | (type: string, listener: <a href="#eventlisteneroreventlistenerobject">EventListenerOrEventListenerObject</a>, options?: boolean \| <a href="#addeventlisteneroptions">AddEventListenerOptions</a>) =&gt; void | Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. |
400
+ | **removeEventListener** | &lt;K extends "abort"&gt;(type: K, listener: (this: <a href="#abortsignal">AbortSignal</a>, ev: AbortSignalEventMap[K]) =&gt; any, options?: boolean \| <a href="#eventlisteneroptions">EventListenerOptions</a>) =&gt; void | Removes the event listener in target's event listener list with the same type, callback, and options. |
401
+ | **removeEventListener** | (type: string, listener: <a href="#eventlisteneroreventlistenerobject">EventListenerOrEventListenerObject</a>, options?: boolean \| <a href="#eventlisteneroptions">EventListenerOptions</a>) =&gt; void | Removes the event listener in target's event listener list with the same type, callback, and options. |
402
+
403
+
404
+ #### AbortSignalEventMap
405
+
406
+ | Prop | Type |
407
+ | ------------- | --------------------------------------- |
408
+ | **`"abort"`** | <code><a href="#event">Event</a></code> |
409
+
410
+
411
+ #### Event
412
+
413
+ An event which takes place in the DOM.
414
+
415
+ | Prop | Type | Description |
416
+ | ---------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
417
+ | **`bubbles`** | <code>boolean</code> | Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. |
418
+ | **`cancelBubble`** | <code>boolean</code> | |
419
+ | **`cancelable`** | <code>boolean</code> | Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. |
420
+ | **`composed`** | <code>boolean</code> | Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. |
421
+ | **`currentTarget`** | <code><a href="#eventtarget">EventTarget</a></code> | Returns the object whose event listener's callback is currently being invoked. |
422
+ | **`defaultPrevented`** | <code>boolean</code> | Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. |
423
+ | **`eventPhase`** | <code>number</code> | Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. |
424
+ | **`isTrusted`** | <code>boolean</code> | Returns true if event was dispatched by the user agent, and false otherwise. |
425
+ | **`returnValue`** | <code>boolean</code> | |
426
+ | **`srcElement`** | <code><a href="#eventtarget">EventTarget</a></code> | |
427
+ | **`target`** | <code><a href="#eventtarget">EventTarget</a></code> | Returns the object to which event is dispatched (its target). |
428
+ | **`timeStamp`** | <code>number</code> | Returns the event's timestamp as the number of milliseconds measured relative to the time origin. |
429
+ | **`type`** | <code>string</code> | Returns the type of event, e.g. "click", "hashchange", or "submit". |
430
+ | **`AT_TARGET`** | <code>number</code> | |
431
+ | **`BUBBLING_PHASE`** | <code>number</code> | |
432
+ | **`CAPTURING_PHASE`** | <code>number</code> | |
433
+ | **`NONE`** | <code>number</code> | |
434
+
435
+ | Method | Signature | Description |
436
+ | ---------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
437
+ | **composedPath** | () =&gt; EventTarget[] | Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. |
438
+ | **initEvent** | (type: string, bubbles?: boolean, cancelable?: boolean) =&gt; void | |
439
+ | **preventDefault** | () =&gt; void | If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. |
440
+ | **stopImmediatePropagation** | () =&gt; void | Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. |
441
+ | **stopPropagation** | () =&gt; void | When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. |
442
+
443
+
444
+ #### EventTarget
445
+
446
+ <a href="#eventtarget">EventTarget</a> is a DOM interface implemented by objects that can receive events and may have listeners for them.
447
+ EventTarget is a DOM interface implemented by objects that can
448
+ receive events and may have listeners for them.
449
+
450
+ | Method | Signature | Description |
451
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
452
+ | **addEventListener** | (type: string, listener: <a href="#eventlisteneroreventlistenerobject">EventListenerOrEventListenerObject</a> \| null, options?: boolean \| <a href="#addeventlisteneroptions">AddEventListenerOptions</a>) =&gt; void | Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. |
453
+ | **dispatchEvent** | (event: <a href="#event">Event</a>) =&gt; boolean | Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. |
454
+ | **removeEventListener** | (type: string, callback: <a href="#eventlisteneroreventlistenerobject">EventListenerOrEventListenerObject</a> \| null, options?: <a href="#eventlisteneroptions">EventListenerOptions</a> \| boolean) =&gt; void | Removes the event listener in target's event listener list with the same type, callback, and options. |
455
+
456
+
457
+ #### EventListener
458
+
459
+
460
+ #### EventListenerObject
461
+
462
+ | Method | Signature |
463
+ | --------------- | -------------------------------------------- |
464
+ | **handleEvent** | (evt: <a href="#event">Event</a>) =&gt; void |
465
+
466
+
467
+ #### AddEventListenerOptions
468
+
469
+ | Prop | Type |
470
+ | ------------- | -------------------- |
471
+ | **`once`** | <code>boolean</code> |
472
+ | **`passive`** | <code>boolean</code> |
473
+
474
+
475
+ #### EventListenerOptions
476
+
477
+ | Prop | Type |
478
+ | ------------- | -------------------- |
479
+ | **`capture`** | <code>boolean</code> |
480
+
481
+
482
+ #### ArrayBufferView
483
+
484
+ | Prop | Type | Description |
485
+ | ---------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------- |
486
+ | **`buffer`** | <code><a href="#arraybufferlike">ArrayBufferLike</a></code> | The <a href="#arraybuffer">ArrayBuffer</a> instance referenced by the array. |
487
+ | **`byteLength`** | <code>number</code> | The length in bytes of the array. |
488
+ | **`byteOffset`** | <code>number</code> | The offset in bytes of the array. |
489
+
490
+
491
+ #### ArrayBufferTypes
492
+
493
+ Allowed <a href="#arraybuffer">ArrayBuffer</a> types for the buffer of an <a href="#arraybufferview">ArrayBufferView</a> and related Typed Arrays.
494
+
495
+ | Prop | Type |
496
+ | ----------------- | --------------------------------------------------- |
497
+ | **`ArrayBuffer`** | <code><a href="#arraybuffer">ArrayBuffer</a></code> |
498
+
499
+
500
+ #### FormData
501
+
502
+ Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
503
+
504
+ | Method | Signature |
505
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
506
+ | **append** | (name: string, value: string \| <a href="#blob">Blob</a>, fileName?: string) =&gt; void |
507
+ | **delete** | (name: string) =&gt; void |
508
+ | **get** | (name: string) =&gt; <a href="#formdataentryvalue">FormDataEntryValue</a> \| null |
509
+ | **getAll** | (name: string) =&gt; FormDataEntryValue[] |
510
+ | **has** | (name: string) =&gt; boolean |
511
+ | **set** | (name: string, value: string \| <a href="#blob">Blob</a>, fileName?: string) =&gt; void |
512
+ | **forEach** | (callbackfn: (value: <a href="#formdataentryvalue">FormDataEntryValue</a>, key: string, parent: <a href="#formdata">FormData</a>) =&gt; void, thisArg?: any) =&gt; void |
513
+
514
+
515
+ #### File
516
+
517
+ Provides information about files and allows JavaScript in a web page to access their content.
518
+
519
+ | Prop | Type |
520
+ | ------------------ | ------------------- |
521
+ | **`lastModified`** | <code>number</code> |
522
+ | **`name`** | <code>string</code> |
523
+
524
+
525
+ #### URLSearchParams
526
+
527
+ <a href="#urlsearchparams">`URLSearchParams`</a> class is a global reference for `require('url').URLSearchParams`
528
+ https://nodejs.org/api/url.html#class-urlsearchparams
529
+
530
+ | Method | Signature | Description |
531
+ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
532
+ | **append** | (name: string, value: string) =&gt; void | Appends a specified key/value pair as a new search parameter. |
533
+ | **delete** | (name: string) =&gt; void | Deletes the given search parameter, and its associated value, from the list of all search parameters. |
534
+ | **get** | (name: string) =&gt; string \| null | Returns the first value associated to the given search parameter. |
535
+ | **getAll** | (name: string) =&gt; string[] | Returns all the values association with a given search parameter. |
536
+ | **has** | (name: string) =&gt; boolean | Returns a Boolean indicating if such a search parameter exists. |
537
+ | **set** | (name: string, value: string) =&gt; void | Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. |
538
+ | **sort** | () =&gt; void | |
539
+ | **toString** | () =&gt; string | Returns a string containing a query string suitable for use in a URL. Does not include the question mark. |
540
+ | **forEach** | (callbackfn: (value: string, key: string, parent: <a href="#urlsearchparams">URLSearchParams</a>) =&gt; void, thisArg?: any) =&gt; void | |
541
+
542
+
543
+ #### Uint8Array
544
+
545
+ A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
546
+ requested number of bytes could not be allocated an exception is raised.
547
+
548
+ | Prop | Type | Description |
549
+ | ----------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------- |
550
+ | **`BYTES_PER_ELEMENT`** | <code>number</code> | The size in bytes of each element in the array. |
551
+ | **`buffer`** | <code><a href="#arraybufferlike">ArrayBufferLike</a></code> | The <a href="#arraybuffer">ArrayBuffer</a> instance referenced by the array. |
552
+ | **`byteLength`** | <code>number</code> | The length in bytes of the array. |
553
+ | **`byteOffset`** | <code>number</code> | The offset in bytes of the array. |
554
+ | **`length`** | <code>number</code> | The length of the array. |
555
+
556
+ | Method | Signature | Description |
557
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
558
+ | **copyWithin** | (target: number, start: number, end?: number) =&gt; this | Returns the this object after copying a section of the array identified by start and end to the same array starting at position target |
559
+ | **every** | (predicate: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; unknown, thisArg?: any) =&gt; boolean | Determines whether all the members of an array satisfy the specified test. |
560
+ | **fill** | (value: number, start?: number, end?: number) =&gt; this | Returns the this object after filling the section identified by start and end with value |
561
+ | **filter** | (predicate: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; any, thisArg?: any) =&gt; <a href="#uint8array">Uint8Array</a> | Returns the elements of an array that meet the condition specified in a callback function. |
562
+ | **find** | (predicate: (value: number, index: number, obj: <a href="#uint8array">Uint8Array</a>) =&gt; boolean, thisArg?: any) =&gt; number \| undefined | Returns the value of the first element in the array where predicate is true, and undefined otherwise. |
563
+ | **findIndex** | (predicate: (value: number, index: number, obj: <a href="#uint8array">Uint8Array</a>) =&gt; boolean, thisArg?: any) =&gt; number | Returns the index of the first element in the array where predicate is true, and -1 otherwise. |
564
+ | **forEach** | (callbackfn: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; void, thisArg?: any) =&gt; void | Performs the specified action for each element in an array. |
565
+ | **indexOf** | (searchElement: number, fromIndex?: number) =&gt; number | Returns the index of the first occurrence of a value in an array. |
566
+ | **join** | (separator?: string) =&gt; string | Adds all the elements of an array separated by the specified separator string. |
567
+ | **lastIndexOf** | (searchElement: number, fromIndex?: number) =&gt; number | Returns the index of the last occurrence of a value in an array. |
568
+ | **map** | (callbackfn: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; number, thisArg?: any) =&gt; <a href="#uint8array">Uint8Array</a> | Calls a defined callback function on each element of an array, and returns an array that contains the results. |
569
+ | **reduce** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; number) =&gt; number | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
570
+ | **reduce** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; number, initialValue: number) =&gt; number | |
571
+ | **reduce** | &lt;U&gt;(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; U, initialValue: U) =&gt; U | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
572
+ | **reduceRight** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; number) =&gt; number | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
573
+ | **reduceRight** | (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; number, initialValue: number) =&gt; number | |
574
+ | **reduceRight** | &lt;U&gt;(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; U, initialValue: U) =&gt; U | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
575
+ | **reverse** | () =&gt; <a href="#uint8array">Uint8Array</a> | Reverses the elements in an Array. |
576
+ | **set** | (array: <a href="#arraylike">ArrayLike</a>&lt;number&gt;, offset?: number) =&gt; void | Sets a value or an array of values. |
577
+ | **slice** | (start?: number, end?: number) =&gt; <a href="#uint8array">Uint8Array</a> | Returns a section of an array. |
578
+ | **some** | (predicate: (value: number, index: number, array: <a href="#uint8array">Uint8Array</a>) =&gt; unknown, thisArg?: any) =&gt; boolean | Determines whether the specified callback function returns true for any element of an array. |
579
+ | **sort** | (compareFn?: (a: number, b: number) =&gt; number) =&gt; this | Sorts an array. |
580
+ | **subarray** | (begin?: number, end?: number) =&gt; <a href="#uint8array">Uint8Array</a> | Gets a new <a href="#uint8array">Uint8Array</a> view of the <a href="#arraybuffer">ArrayBuffer</a> store for this array, referencing the elements at begin, inclusive, up to end, exclusive. |
581
+ | **toLocaleString** | () =&gt; string | Converts a number to a string by using the current locale. |
582
+ | **toString** | () =&gt; string | Returns a string representation of an array. |
583
+ | **valueOf** | () =&gt; <a href="#uint8array">Uint8Array</a> | Returns the primitive value of the specified object. |
584
+
585
+
586
+ #### ArrayLike
587
+
588
+ | Prop | Type |
589
+ | ------------ | ------------------- |
590
+ | **`length`** | <code>number</code> |
591
+
592
+
593
+ #### Headers
594
+
595
+ This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A <a href="#headers">Headers</a> object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.
596
+
597
+ | Method | Signature |
598
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------- |
599
+ | **append** | (name: string, value: string) =&gt; void |
600
+ | **delete** | (name: string) =&gt; void |
601
+ | **get** | (name: string) =&gt; string \| null |
602
+ | **has** | (name: string) =&gt; boolean |
603
+ | **set** | (name: string, value: string) =&gt; void |
604
+ | **forEach** | (callbackfn: (value: string, key: string, parent: <a href="#headers">Headers</a>) =&gt; void, thisArg?: any) =&gt; void |
605
+
606
+
607
+ ### Type Aliases
608
+
609
+
610
+ #### BodyInit
611
+
612
+ <code><a href="#blob">Blob</a> | <a href="#buffersource">BufferSource</a> | <a href="#formdata">FormData</a> | <a href="#urlsearchparams">URLSearchParams</a> | <a href="#readablestream">ReadableStream</a>&lt;<a href="#uint8array">Uint8Array</a>&gt; | string</code>
613
+
614
+
615
+ #### ReadableStreamDefaultReadResult
616
+
617
+ <code><a href="#readablestreamdefaultreadvalueresult">ReadableStreamDefaultReadValueResult</a>&lt;T&gt; | <a href="#readablestreamdefaultreaddoneresult">ReadableStreamDefaultReadDoneResult</a></code>
618
+
619
+
620
+ #### EventListenerOrEventListenerObject
621
+
622
+ <code><a href="#eventlistener">EventListener</a> | <a href="#eventlistenerobject">EventListenerObject</a></code>
623
+
624
+
625
+ #### BufferSource
626
+
627
+ <code><a href="#arraybufferview">ArrayBufferView</a> | <a href="#arraybuffer">ArrayBuffer</a></code>
628
+
629
+
630
+ #### ArrayBufferLike
631
+
632
+ <code>ArrayBufferTypes[keyof ArrayBufferTypes]</code>
633
+
634
+
635
+ #### FormDataEntryValue
636
+
637
+ <code><a href="#file">File</a> | string</code>
638
+
639
+
640
+ #### RequestCache
641
+
642
+ <code>"default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"</code>
643
+
644
+
645
+ #### RequestCredentials
646
+
647
+ <code>"include" | "omit" | "same-origin"</code>
648
+
649
+
650
+ #### HeadersInit
651
+
652
+ <code><a href="#headers">Headers</a> | string[][] | <a href="#record">Record</a>&lt;string, string&gt;</code>
653
+
654
+
655
+ #### Record
656
+
657
+ Construct a type with a set of properties K of type T
658
+
659
+ <code>{
660
  [P in K]: T;
1
661
  }</code>
662
+
663
+
664
+ #### RequestMode
665
+
666
+ <code>"cors" | "navigate" | "no-cors" | "same-origin"</code>
667
+
668
+
669
+ #### RequestRedirect
670
+
671
+ <code>"error" | "follow" | "manual"</code>
672
+
673
+
674
+ #### ReferrerPolicy
675
+
676
+ <code>"" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"</code>
677
+
678
+
679
+ #### HttpResponseType
680
+
681
+ How to parse the Http response before returning it to the client.
682
+
683
+ <code>'arraybuffer' | 'blob' | 'json' | 'text' | 'document'</code>
684
+
685
+ </docgen-api>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/core",
3
- "version": "6.0.0-rc.0",
3
+ "version": "6.0.0-rc.2",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -15,16 +15,19 @@
15
15
  "files": [
16
16
  "dist/",
17
17
  "types/",
18
- "cordova.js"
18
+ "cookies.md",
19
+ "cordova.js",
20
+ "http.md"
19
21
  ],
20
22
  "main": "dist/index.cjs.js",
21
23
  "module": "dist/index.js",
22
24
  "types": "types/index.d.ts",
23
25
  "unpkg": "dist/capacitor.js",
24
26
  "scripts": {
25
- "build": "npm run clean && npm run transpile && npm run rollup",
27
+ "build": "npm run clean && npm run docgen && npm run transpile && npm run rollup",
26
28
  "build:nativebridge": "tsc native-bridge.ts --target es2017 --moduleResolution node --outDir build && rollup --config rollup.bridge.config.js",
27
29
  "clean": "rimraf dist",
30
+ "docgen": "docgen --api CapacitorCookiesPlugin --output-readme cookies.md && docgen --api CapacitorHttpPlugin --output-readme http.md",
28
31
  "prepublishOnly": "npm run build",
29
32
  "rollup": "rollup --config rollup.config.js",
30
33
  "transpile": "tsc",
@@ -36,6 +39,7 @@
36
39
  "tslib": "^2.1.0"
37
40
  },
38
41
  "devDependencies": {
42
+ "@capacitor/docgen": "^0.2.2",
39
43
  "@rollup/plugin-node-resolve": "^10.0.0",
40
44
  "@rollup/plugin-replace": "^2.4.2",
41
45
  "@types/jest": "^29.5.0",
@@ -2,6 +2,7 @@ import type { Plugin } from './definitions';
2
2
  import { WebPlugin } from './web-plugin';
3
3
  /******** WEB VIEW PLUGIN ********/
4
4
  export interface WebViewPlugin extends Plugin {
5
+ setServerAssetPath(options: WebViewPath): Promise<void>;
5
6
  setServerBasePath(options: WebViewPath): Promise<void>;
6
7
  getServerBasePath(): Promise<WebViewPath>;
7
8
  persistServerBasePath(): Promise<void>;
@@ -12,21 +13,48 @@ export interface WebViewPath {
12
13
  export declare const WebView: WebViewPlugin;
13
14
  export interface CapacitorCookiesPlugin {
14
15
  getCookies(options?: GetCookieOptions): Promise<HttpCookieMap>;
16
+ /**
17
+ * Write a cookie to the device.
18
+ */
15
19
  setCookie(options: SetCookieOptions): Promise<void>;
20
+ /**
21
+ * Delete a cookie from the device.
22
+ */
16
23
  deleteCookie(options: DeleteCookieOptions): Promise<void>;
24
+ /**
25
+ * Clear cookies from the device at a given URL.
26
+ */
17
27
  clearCookies(options: ClearCookieOptions): Promise<void>;
28
+ /**
29
+ * Clear all cookies on the device.
30
+ */
18
31
  clearAllCookies(): Promise<void>;
19
32
  }
20
33
  interface HttpCookie {
34
+ /**
35
+ * The URL of the cookie.
36
+ */
21
37
  url?: string;
38
+ /**
39
+ * The key of the cookie.
40
+ */
22
41
  key: string;
42
+ /**
43
+ * The value of the cookie.
44
+ */
23
45
  value: string;
24
46
  }
25
47
  interface HttpCookieMap {
26
48
  [key: string]: string;
27
49
  }
28
50
  interface HttpCookieExtras {
51
+ /**
52
+ * The path to write the cookie to.
53
+ */
29
54
  path?: string;
55
+ /**
56
+ * The date to expire the cookie.
57
+ */
30
58
  expires?: string;
31
59
  }
32
60
  export type GetCookieOptions = Omit<HttpCookie, 'key' | 'value'>;
@@ -44,17 +72,47 @@ export declare const CapacitorCookies: CapacitorCookiesPlugin;
44
72
  /******** END COOKIES PLUGIN ********/
45
73
  /******** HTTP PLUGIN ********/
46
74
  export interface CapacitorHttpPlugin {
75
+ /**
76
+ * Make a Http Request to a server using native libraries.
77
+ */
47
78
  request(options: HttpOptions): Promise<HttpResponse>;
79
+ /**
80
+ * Make a Http GET Request to a server using native libraries.
81
+ */
48
82
  get(options: HttpOptions): Promise<HttpResponse>;
83
+ /**
84
+ * Make a Http POST Request to a server using native libraries.
85
+ */
49
86
  post(options: HttpOptions): Promise<HttpResponse>;
87
+ /**
88
+ * Make a Http PUT Request to a server using native libraries.
89
+ */
50
90
  put(options: HttpOptions): Promise<HttpResponse>;
91
+ /**
92
+ * Make a Http PATCH Request to a server using native libraries.
93
+ */
51
94
  patch(options: HttpOptions): Promise<HttpResponse>;
95
+ /**
96
+ * Make a Http DELETE Request to a server using native libraries.
97
+ */
52
98
  delete(options: HttpOptions): Promise<HttpResponse>;
53
99
  }
100
+ /**
101
+ * How to parse the Http response before returning it to the client.
102
+ */
54
103
  export type HttpResponseType = 'arraybuffer' | 'blob' | 'json' | 'text' | 'document';
55
104
  export interface HttpOptions {
105
+ /**
106
+ * The URL to send the request to.
107
+ */
56
108
  url: string;
109
+ /**
110
+ * The Http Request method to run. (Default is GET)
111
+ */
57
112
  method?: string;
113
+ /**
114
+ * URL parameters to append to the request.
115
+ */
58
116
  params?: HttpParams;
59
117
  /**
60
118
  * Note: On Android and iOS, data can only be a string or a JSON.
@@ -65,14 +123,17 @@ export interface HttpOptions {
65
123
  * and set the `headers["Content-Type"]` and `dataType` attributes accordingly.
66
124
  */
67
125
  data?: any;
126
+ /**
127
+ * Http Request headers to send with the request.
128
+ */
68
129
  headers?: HttpHeaders;
69
130
  /**
70
- * How long to wait to read additional data. Resets each time new
71
- * data is received
131
+ * How long to wait to read additional data in milliseconds.
132
+ * Resets each time new data is received.
72
133
  */
73
134
  readTimeout?: number;
74
135
  /**
75
- * How long to wait for the initial connection.
136
+ * How long to wait for the initial connection in milliseconds.
76
137
  */
77
138
  connectTimeout?: number;
78
139
  /**
@@ -100,15 +161,33 @@ export interface HttpOptions {
100
161
  dataType?: 'file' | 'formData';
101
162
  }
102
163
  export interface HttpParams {
164
+ /**
165
+ * A key/value dictionary of URL parameters to set.
166
+ */
103
167
  [key: string]: string | string[];
104
168
  }
105
169
  export interface HttpHeaders {
170
+ /**
171
+ * A key/value dictionary of Http headers.
172
+ */
106
173
  [key: string]: string;
107
174
  }
108
175
  export interface HttpResponse {
176
+ /**
177
+ * Additional data received with the Http response.
178
+ */
109
179
  data: any;
180
+ /**
181
+ * The status code received from the Http response.
182
+ */
110
183
  status: number;
184
+ /**
185
+ * The headers received from the Http response.
186
+ */
111
187
  headers: HttpHeaders;
188
+ /**
189
+ * The response URL recieved from the Http response.
190
+ */
112
191
  url: string;
113
192
  }
114
193
  /**
@@ -135,6 +135,7 @@ export interface WindowCapacitor {
135
135
  WebView?: {
136
136
  getServerBasePath?: any;
137
137
  setServerBasePath?: any;
138
+ setServerAssetPath?: any;
138
139
  persistServerBasePath?: any;
139
140
  convertFileSrc?: any;
140
141
  };