fix spec and docs
This commit is contained in:
parent
b91217f29e
commit
4749e18fc0
4 changed files with 18 additions and 24 deletions
|
@ -553,18 +553,16 @@ The `listener` will be called with `listener(details)` when an error occurs.
|
|||
Returns an instance of [protocol](protocol.md) module for this session.
|
||||
|
||||
```javascript
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const session = electron.session;
|
||||
const path = require('path');
|
||||
const {app, session} = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.on('ready', function() {
|
||||
const protocol = session.fromPartition(partitionName).protocol;
|
||||
protocol.registerFileProtocol('atom', function(request, callback) {
|
||||
var url = request.url.substr(7);
|
||||
callback({path: path.normalize(__dirname + '/' + url)});
|
||||
app.on('ready', function () {
|
||||
const protocol = session.fromPartition(partitionName).protocol
|
||||
protocol.registerFileProtocol('atom', function (request, callback) {
|
||||
var url = request.url.substr(7)
|
||||
callback({path: path.normalize(__dirname + '/' + url)})
|
||||
}, function (error) {
|
||||
if (error)
|
||||
console.error('Failed to register protocol')
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue