Warn about removed protocol APIs
This commit is contained in:
		
					parent
					
						
							
								61b7a3afe3
							
						
					
				
			
			
				commit
				
					
						d931a49e89
					
				
			
		
					 1 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -3,4 +3,22 @@ throw new Error('Can not initialize protocol module before app is ready') unless
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protocol = process.atomBinding('protocol').protocol
 | 
					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
 | 
					module.exports = protocol
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue