]> khamidou — GitHub mirrors - electron.git/commitdiff
Warn about removed protocol APIs
authorCheng Zhao <zcbenz@gmail.com>
Fri, 21 Aug 2015 10:02:58 +0000 (18:02 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 21 Aug 2015 10:02:58 +0000 (18:02 +0800)
atom/browser/api/lib/protocol.coffee

index 4a45c702507c663f75f6f1469db230c7302abfa2..13f2a6d10270c06dc150526aad578965ed11d6c1 100644 (file)
@@ -3,4 +3,22 @@ throw new Error('Can not initialize protocol module before app is ready') unless
 
 protocol = process.atomBinding('protocol').protocol
 
+# 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.'
+
 module.exports = protocol