Convert all source files to JavaScript
This commit is contained in:
parent
403870a27e
commit
1f9691ae13
144 changed files with 11211 additions and 7301 deletions
35
atom/browser/api/lib/protocol.js
Normal file
35
atom/browser/api/lib/protocol.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
var app, logAndThrow, protocol;
|
||||
|
||||
app = require('electron').app;
|
||||
|
||||
if (!app.isReady()) {
|
||||
throw new Error('Can not initialize protocol module before app is ready');
|
||||
}
|
||||
|
||||
protocol = process.atomBinding('protocol').protocol;
|
||||
|
||||
|
||||
/* Warn about removed APIs. */
|
||||
|
||||
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;
|
Loading…
Add table
Add a link
Reference in a new issue