2016-05-08 11:14:14 +00:00
|
|
|
const app = require('electron').app
|
|
|
|
const {createProtocolObject, registerStandardSchemes} = process.atomBinding('protocol')
|
2016-01-12 02:40:23 +00:00
|
|
|
|
2016-05-08 11:14:14 +00:00
|
|
|
exports.registerStandardSchemes = function (schemes) {
|
|
|
|
if (app.isReady()) {
|
|
|
|
throw new Error('protocol.registerStandardSchemes should be called before app is ready')
|
|
|
|
}
|
|
|
|
registerStandardSchemes(schemes)
|
2016-03-24 20:15:04 +00:00
|
|
|
}
|
2016-01-12 02:40:23 +00:00
|
|
|
|
2016-05-08 11:14:14 +00:00
|
|
|
app.once('ready', function () {
|
2016-05-09 00:22:03 +00:00
|
|
|
let protocol = createProtocolObject()
|
2016-05-08 11:14:14 +00:00
|
|
|
for (let method in protocol) {
|
|
|
|
exports[method] = protocol[method].bind(protocol)
|
|
|
|
}
|
|
|
|
})
|