mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
docs: fix protocol.registerFileProtocol() usage in session.md (#25949)
This commit is contained in:
@@ -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')
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user