feat: deprecate desktopCapturer.getSources in the renderer (#30721)
This commit is contained in:
		
					parent
					
						
							
								6d4995ec17
							
						
					
				
			
			
				commit
				
					
						ee0e15a52e
					
				
			
		
					 2 changed files with 48 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
 | 
			
		||||
import { deserialize } from '@electron/internal/common/type-utils';
 | 
			
		||||
import deprecate from '@electron/internal/common/api/deprecate';
 | 
			
		||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
 | 
			
		||||
 | 
			
		||||
const { hasSwitch } = process._linkedBinding('electron_common_command_line');
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +15,11 @@ function getCurrentStack () {
 | 
			
		|||
  return (target as any).stack;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let warned = process.noDeprecation;
 | 
			
		||||
export async function getSources (options: Electron.SourcesOptions) {
 | 
			
		||||
  if (!warned) {
 | 
			
		||||
    deprecate.log('The use of \'desktopCapturer.getSources\' in the renderer process is deprecated and will be removed. See https://www.electronjs.org/docs/breaking-changes#removed-desktopcapturergetsources-in-the-renderer for more details.');
 | 
			
		||||
    warned = true;
 | 
			
		||||
  }
 | 
			
		||||
  return deserialize(await ipcRendererInternal.invoke(IPC_MESSAGES.DESKTOP_CAPTURER_GET_SOURCES, options, getCurrentStack()));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue