Es6ify api docs (#21686)

* docs: es6ify docs -> var -> const / let

* docs: apply arrow functions throughout all of the docs
This commit is contained in:
Jorn 2020-01-13 02:29:46 +01:00 committed by Cheng Zhao
parent 29b7d80eb5
commit aef9ab1bb7
6 changed files with 23 additions and 23 deletions

View file

@ -519,12 +519,12 @@ A [`Protocol`](protocol.md) object for this session.
const { app, session } = require('electron')
const path = require('path')
app.on('ready', function () {
app.on('ready', () => {
const protocol = session.fromPartition('some-partition').protocol
protocol.registerFileProtocol('atom', function (request, callback) {
var url = request.url.substr(7)
protocol.registerFileProtocol('atom', (request, callback) => {
let url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
}, function (error) {
}, (error) => {
if (error) console.error('Failed to register protocol')
})
})
@ -537,7 +537,7 @@ A [`NetLog`](net-log.md) object for this session.
```javascript
const { app, session } = require('electron')
app.on('ready', async function () {
app.on('ready', async () => {
const netLog = session.fromPartition('some-partition').netLog
netLog.startLogging('/path/to/net-log')
// After some network events