electron/lib/browser/api/protocol.js

26 lines
923 B
JavaScript
Raw Normal View History

const protocol = process.atomBinding('protocol').protocol
2016-01-12 02:40:23 +00:00
2016-01-14 18:35:29 +00:00
// Warn about removed APIs.
var logAndThrow = function (callback, message) {
console.error(message)
2016-01-12 02:40:23 +00:00
if (callback) {
return callback(new Error(message))
2016-01-12 02:40:23 +00:00
} else {
throw new Error(message)
2016-01-12 02:40:23 +00:00
}
}
2016-01-12 02:40:23 +00:00
protocol.registerProtocol = function (scheme, handler, callback) {
return logAndThrow(callback, 'registerProtocol API has been replaced by the register[File/Http/Buffer/String]Protocol API family, please switch to the new APIs.')
}
2016-01-12 02:40:23 +00:00
protocol.isHandledProtocol = function (scheme, callback) {
return logAndThrow(callback, 'isHandledProtocol API has been replaced by isProtocolHandled.')
}
2016-01-12 02:40:23 +00:00
protocol.interceptProtocol = function (scheme, handler, callback) {
return logAndThrow(callback, 'interceptProtocol API has been replaced by the intercept[File/Http/Buffer/String]Protocol API family, please switch to the new APIs.')
}
2016-01-12 02:40:23 +00:00
module.exports = protocol