2015-11-12 10:28:04 +00:00
|
|
|
{app} = require 'electron'
|
|
|
|
|
2014-10-30 14:27:29 +00:00
|
|
|
throw new Error('Can not initialize protocol module before app is ready') unless app.isReady()
|
|
|
|
|
2015-11-12 10:28:04 +00:00
|
|
|
{protocol} = process.atomBinding 'protocol'
|
2015-05-29 15:54:00 +00:00
|
|
|
|
2015-08-21 10:02:58 +00:00
|
|
|
# Warn about removed APIs.
|
|
|
|
logAndThrow = (callback, message) ->
|
|
|
|
console.error message
|
|
|
|
if callback then callback(new Error(message)) else throw new Error(message)
|
|
|
|
protocol.registerProtocol = (scheme, handler, callback) ->
|
|
|
|
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 = (scheme, callback) ->
|
|
|
|
logAndThrow callback,
|
|
|
|
'isHandledProtocol API has been replaced by isProtocolHandled.'
|
|
|
|
protocol.interceptProtocol = (scheme, handler, callback) ->
|
|
|
|
logAndThrow callback,
|
|
|
|
'interceptProtocol API has been replaced by the
|
|
|
|
intercept[File/Http/Buffer/String]Protocol API family, please
|
|
|
|
switch to the new APIs.'
|
|
|
|
|
2013-08-29 12:38:04 +00:00
|
|
|
module.exports = protocol
|