docs: fix protocol.registerFileProtocol() usage in session.md (#25949)

This commit is contained in:
Milan Burda 2020-10-15 20:11:14 +02:00 committed by GitHub
parent 82424350bf
commit beaed6c434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -789,12 +789,12 @@ const path = require('path')
app.whenReady().then(() => {
const protocol = session.fromPartition('some-partition').protocol
protocol.registerFileProtocol('atom', (request, callback) => {
if (!protocol.registerFileProtocol('atom', (request, callback) => {
const url = request.url.substr(7)
callback({ path: path.normalize(`${__dirname}/${url}`) })
}, (error) => {
if (error) console.error('Failed to register protocol')
})
})) {
console.error('Failed to register protocol')
}
})
```