docs: fix protocol.registerFileProtocol() usage in session.md (#25949)
This commit is contained in:
parent
82424350bf
commit
beaed6c434
1 changed files with 4 additions and 4 deletions
|
@ -789,12 +789,12 @@ const path = require('path')
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
const protocol = session.fromPartition('some-partition').protocol
|
const protocol = session.fromPartition('some-partition').protocol
|
||||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
if (!protocol.registerFileProtocol('atom', (request, callback) => {
|
||||||
const url = request.url.substr(7)
|
const url = request.url.substr(7)
|
||||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||||
}, (error) => {
|
})) {
|
||||||
if (error) console.error('Failed to register protocol')
|
console.error('Failed to register protocol')
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue