2016-05-09 09:49:28 +09:00
|
|
|
const {app} = require('electron')
|
2016-05-08 16:44:14 +05:30
|
|
|
const {createProtocolObject, registerStandardSchemes} = process.atomBinding('protocol')
|
2016-01-11 18:40:23 -08:00
|
|
|
|
2016-05-08 16:44:14 +05:30
|
|
|
exports.registerStandardSchemes = function (schemes) {
|
|
|
|
if (app.isReady()) {
|
2016-05-09 09:49:28 +09:00
|
|
|
console.warn('protocol.registerStandardSchemes should be called before app is ready')
|
|
|
|
return
|
2016-05-08 16:44:14 +05:30
|
|
|
}
|
|
|
|
registerStandardSchemes(schemes)
|
2016-03-24 13:15:04 -07:00
|
|
|
}
|
2016-01-11 18:40:23 -08:00
|
|
|
|
2016-05-08 16:44:14 +05:30
|
|
|
app.once('ready', function () {
|
2016-05-09 09:22:03 +09:00
|
|
|
let protocol = createProtocolObject()
|
2016-05-08 16:44:14 +05:30
|
|
|
for (let method in protocol) {
|
|
|
|
exports[method] = protocol[method].bind(protocol)
|
|
|
|
}
|
|
|
|
})
|