-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b49944
commit 56087e9
Showing
3 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
chrome-devtools-client | ||
====================== | ||
chrome-debugging-client | ||
======================= | ||
|
||
Example: | ||
|
||
```js | ||
import { createSession } from "./index"; | ||
|
||
createSession(async (session) => { | ||
let process = await session.spawn("canary"); | ||
let client = session.createAPIClient("localhost", process.remoteDebuggingPort); | ||
let version = await client.version(); | ||
console.log(JSON.stringify(version, null, 2)); | ||
let tabs = await client.listTabs(); | ||
let tab = tabs[0]; | ||
await client.activateTab(tab.id); | ||
let debugging = await session.openDebuggingProtocol(tab.webSocketDebuggerUrl); | ||
await debugging.send("HeapProfiler.enable", {}); | ||
let buffer = ""; | ||
debugging.on("HeapProfiler.addHeapSnapshotChunk", (evt) => { | ||
buffer += evt.chunk; | ||
}); | ||
await debugging.send("HeapProfiler.takeHeapSnapshot", {}); | ||
return JSON.parse(buffer); | ||
}).then((data) => { | ||
console.log(data.snapshot.meta); | ||
}).catch((err) => { | ||
console.error(err); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters