electron/lib/browser/api/protocol.js

18 lines
510 B
JavaScript
Raw Normal View History

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()) {
console.warn('protocol.registerStandardSchemes should be called before app is ready')
return
2016-05-08 16:44:14 +05:30
}
registerStandardSchemes(schemes)
}
2016-01-11 18:40:23 -08:00
2016-05-08 16:44:14 +05:30
app.once('ready', function () {
let protocol = createProtocolObject()
2016-05-08 16:44:14 +05:30
for (let method in protocol) {
exports[method] = protocol[method].bind(protocol)
}
})