Merge pull request #8572 from electron/content-tracing-app-ready
Document using content tracing after app ready
This commit is contained in:
commit
2f3578679f
1 changed files with 18 additions and 12 deletions
|
@ -9,22 +9,28 @@ This module does not include a web interface so you need to open
|
|||
`chrome://tracing/` in a Chrome browser and load the generated file to view the
|
||||
result.
|
||||
|
||||
**Note:** You should not use this module until the `ready` event of the app
|
||||
module is emitted.
|
||||
|
||||
|
||||
```javascript
|
||||
const {contentTracing} = require('electron')
|
||||
const {app, contentTracing} = require('electron')
|
||||
|
||||
const options = {
|
||||
categoryFilter: '*',
|
||||
traceOptions: 'record-until-full,enable-sampling'
|
||||
}
|
||||
app.on('ready', () => {
|
||||
const options = {
|
||||
categoryFilter: '*',
|
||||
traceOptions: 'record-until-full,enable-sampling'
|
||||
}
|
||||
|
||||
contentTracing.startRecording(options, () => {
|
||||
console.log('Tracing started')
|
||||
contentTracing.startRecording(options, () => {
|
||||
console.log('Tracing started')
|
||||
|
||||
setTimeout(() => {
|
||||
contentTracing.stopRecording('', (path) => {
|
||||
console.log('Tracing data recorded to ' + path)
|
||||
})
|
||||
}, 5000)
|
||||
setTimeout(() => {
|
||||
contentTracing.stopRecording('', (path) => {
|
||||
console.log('Tracing data recorded to ' + path)
|
||||
})
|
||||
}, 5000)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue