Skip to content

Commit

Permalink
adding comment line for p
Browse files Browse the repository at this point in the history
  • Loading branch information
crysmags committed Jun 3, 2024
1 parent 2f20137 commit 1a06cff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/docs/api/DiagnosticsChannel.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ This message is published when `fetch` is called, and will publish the arguments

```js
import diagnosticsChannel from 'diagnostics_channel'
diagnosticsChannel.channel('tracing:undici:fetch:start').subscribe(({ input, init }) => {
diagnosticsChannel.channel('tracing:undici:fetch:start').subscribe(({ req, input, init, }) => {
console.log('input', input)
console.log('init', init)
})
Expand All @@ -221,7 +221,7 @@ diagnosticsChannel.channel('tracing:undici:fetch:start').subscribe(({ input, ini
This message is published at the end of `fetch`'s execution, and will publish any `error` from the synchronous part of `fetch`. Since `fetch` is asynchronous, this should be empty. This channel will publish the same values as `undici:fetch:start`, but we are including it to track when `fetch` finishes execution and to be consistent with [`TracingChannel`](https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel).
```js
import diagnosticsChannel from 'diagnostics_channel'
diagnosticsChannel.channel('tracing:undici:fetch:end').subscribe(({ input, init, error }) => {
diagnosticsChannel.channel('tracing:undici:fetch:end').subscribe(({ req, input, init, error }) => {
console.log('input', input)
console.log('init', init)
console.log('error', error) // should be empty
Expand All @@ -231,7 +231,7 @@ diagnosticsChannel.channel('tracing:undici:fetch:end').subscribe(({ input, init,
This message is published after `fetch` resolves or rejects. If `fetch` resolves, it publishes the response in `result`. If it rejects, it publishes the error in `error`.
```js
import diagnosticsChannel from 'diagnostics_channel'
diagnosticsChannel.channel('tracing:undici:fetch:asyncStart').subscribe(({ input, init, result, error }) => {
diagnosticsChannel.channel('tracing:undici:fetch:asyncStart').subscribe(({ req, input, init, result, error }) => {
console.log('input', input)
console.log('init', init)
console.log('response', result)
Expand All @@ -242,7 +242,7 @@ diagnosticsChannel.channel('tracing:undici:fetch:asyncStart').subscribe(({ input
This channel gets published the same values as and at the same time as `tracing:undici:fetch:asyncStart` in the case of [`tracingChannel.tracePromise`](https://nodejs.org/api/diagnostics_channel.html#tracingchanneltracepromisefn-context-thisarg-args)
```js
import diagnosticsChannel from 'diagnostics_channel'
diagnosticsChannel.channel('tracing:undici:fetch:asyncEnd').subscribe(({ input, init, result, error }) => {
diagnosticsChannel.channel('tracing:undici:fetch:asyncEnd').subscribe(({ req, input, init, result, error }) => {
console.log('input', input)
console.log('init', init)
console.log('response', result)
Expand All @@ -253,7 +253,7 @@ diagnosticsChannel.channel('tracing:undici:fetch:asyncEnd').subscribe(({ input,
This message is published when an error is thrown or promise rejects while calling `fetch`.
```js
import diagnosticsChannel from 'diagnostics_channel'
diagnosticsChannel.channel('tracing:undici:fetch:error').subscribe(({ input, init, error }) => {
diagnosticsChannel.channel('tracing:undici:fetch:error').subscribe(({ req, input, init, error }) => {
console.log('input', input)
console.log('init', init)
console.log('error', error)
Expand Down
2 changes: 2 additions & 0 deletions lib/web/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ function createInstrumentedDeferredPromise (context) {
function fetch (input, init = undefined) {
webidl.argumentLengthCheck(arguments, 1, 'globalThis.fetch')

// 1. Let p be a new promise.

// 2. Let requestObject be the result of invoking the initial value of
// Request as constructor with input and init as arguments. If this throws
// an exception, reject p with it and return p.
Expand Down

0 comments on commit 1a06cff

Please sign in to comment.