This commit is contained in:
deepak1556 2016-06-08 21:18:32 +05:30
parent aa853dd3be
commit ebff40b5a5

View file

@ -547,3 +547,24 @@ The `listener` will be called with `listener(details)` when an error occurs.
* `timestamp` Double * `timestamp` Double
* `fromCache` Boolean * `fromCache` Boolean
* `error` String - The error description. * `error` String - The error description.
#### `ses.protocol`
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');
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')
});
});