Move JavaScript to root lib/ folder

This commit is contained in:
Kevin Sawicki 2016-03-07 17:12:09 -08:00
parent a9c40de393
commit 70aa9b06ee
56 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,31 @@
const app = require('electron').app;
if (!app.isReady()) {
throw new Error('Can not initialize protocol module before app is ready');
}
const protocol = process.atomBinding('protocol').protocol;
// Warn about removed APIs.
var logAndThrow = function(callback, message) {
console.error(message);
if (callback) {
return callback(new Error(message));
} else {
throw new Error(message);
}
};
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.');
};
protocol.isHandledProtocol = function(scheme, callback) {
return logAndThrow(callback, 'isHandledProtocol API has been replaced by isProtocolHandled.');
};
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.');
};
module.exports = protocol;