Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add code example to inspector.url() method #29496

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/api/inspector.md
Expand Up @@ -52,6 +52,21 @@ parameter usage.

Return the URL of the active inspector, or `undefined` if there is none.

```js
// Node process was called with --inspect flag
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
require('inspector').url()
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
'ws://127.0.0.1:9229/whatever'
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved

// Node process was called with --inspect=localhost:3000 flag
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
require('inspector').url()
'ws://localhost:3000/whatever'
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
// ---^ host ---^ port
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved

// Node process was called without --inspect flag
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
require('inspector').url()
undefined
```

## inspector.waitForDebugger()
<!-- YAML
added: v12.7.0
Expand Down