Skip to content

Commit adf146e

Browse files
committed
chore: commented
1 parent fadf074 commit adf146e

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

examples/fetch.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
const foo = async () => {
2-
const res = await fetch("https://developer.mozilla.org");
3-
console.log(res);
2+
try {
3+
const res = await fetch("https://developer.mozilla.org");
4+
console.log(res);
5+
} catch (e) {
6+
console.error(e);
7+
}
48
};
59

610
foo();

runtime/src/ext/fetch/fetch/mod.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@ const fetch = (input: RequestInfo, init = undefined) => {
3030
}
3131

3232
// 4. If requestObject’s signal is aborted, then:
33-
if (request.signal.aborted) {
34-
// 1. Abort the fetch() call with p, request, null, and
35-
// requestObject’s signal’s abort reason.
36-
//
37-
// TODO: abortFetch
38-
//
39-
// 2. Return p.
40-
return p.promise;
41-
}
33+
// if (request.signal.aborted) {
34+
// 1. Abort the fetch() call with p, request, null, and
35+
// requestObject’s signal’s abort reason.
36+
//
37+
// TODO: abortFetch
38+
//
39+
// 2. Return p.
40+
// return p.promise;
41+
// }
4242

4343
// 5. Let globalObject be request’s client’s global object.
44-
const globalObject = request.client.globalObject;
44+
// const globalObject = request.client.globalObject;
4545

4646
// 6. If globalObject is a ServiceWorkerGlobalScope object,
4747
// then set request’s service-workers mode to "none".
48-
if (globalObject?.constructor?.name === "ServiceWorkerGlobalScope") {
49-
request.serviceWorkers = "none";
50-
}
48+
// if (globalObject?.constructor?.name === "ServiceWorkerGlobalScope") {
49+
// request.serviceWorkers = "none";
50+
// }
5151

5252
// 7. Let responseObject be null.
5353
let responseObject = null;
@@ -71,7 +71,7 @@ const fetch = (input: RequestInfo, init = undefined) => {
7171
// and requestObject’s signal’s abort reason.
7272

7373
// 12. Set controller to the result of calling fetch given request
74-
// and processResponse given response being these steps:
74+
// and processResponse given response being these steps:
7575
// 1. If locallyAborted is true, then abort these steps.
7676
// 2. If response’s aborted flag is set, then:
7777
// 1. Let deserializedError be the result of deserialize a serialized abort reason given controller’s serialized abort reason and relevantRealm.

0 commit comments

Comments
 (0)