electron/lib/browser/api/protocol.js

18 lines
510 B
JavaScript
Raw Normal View History

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