Skip to content

Commit aae39a6

Browse files
wip(docs): simplify example
1 parent fb36f7f commit aae39a6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,12 @@ interface Options {
107107
* **example:**
108108
* ```javascript
109109
* ...
110-
* getFile(url) {
110+
* async getFile(url) {
111111
*
112-
* return fetch(url).then(response => response.ok ? response.text() : Promise.reject(response));
112+
* const res = await fetch(url);
113+
* if ( !res.ok )
114+
* throw Object.assign(new Error(url+' '+res.statusText), { res });
115+
* return await res.text();
113116
* },
114117
* ...
115118
* ```

0 commit comments

Comments
 (0)