From ebff40b5a5371c7433db1068fc9213565e587b0d Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 8 Jun 2016 21:18:32 +0530 Subject: [PATCH] add docs --- docs/api/session.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/api/session.md b/docs/api/session.md index e7affddde932..e21613b7288e 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -547,3 +547,24 @@ The `listener` will be called with `listener(details)` when an error occurs. * `timestamp` Double * `fromCache` Boolean * `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') + }); +});