2020-03-20 20:28:31 +00:00
|
|
|
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
2020-05-13 17:05:53 +00:00
|
|
|
import { deserialize } from '@electron/internal/common/type-utils';
|
2019-06-15 10:44:18 +00:00
|
|
|
|
2020-06-23 03:32:45 +00:00
|
|
|
const { hasSwitch } = process._linkedBinding('electron_common_command_line');
|
2019-10-04 17:49:09 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const enableStacks = hasSwitch('enable-api-filtering-logging');
|
2019-10-04 17:49:09 +00:00
|
|
|
|
|
|
|
function getCurrentStack () {
|
2020-03-20 20:28:31 +00:00
|
|
|
const target = {};
|
2019-10-04 17:49:09 +00:00
|
|
|
if (enableStacks) {
|
2020-03-20 20:28:31 +00:00
|
|
|
Error.captureStackTrace(target, getCurrentStack);
|
2019-10-04 17:49:09 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
return (target as any).stack;
|
2019-10-04 17:49:09 +00:00
|
|
|
}
|
|
|
|
|
2019-06-15 10:44:18 +00:00
|
|
|
export async function getSources (options: Electron.SourcesOptions) {
|
2020-05-21 00:25:49 +00:00
|
|
|
return deserialize(await ipcRendererInternal.invoke('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', options, getCurrentStack()));
|
2019-06-15 10:44:18 +00:00
|
|
|
}
|
2020-05-26 20:34:24 +00:00
|
|
|
|
|
|
|
export function getMediaSourceIdForWebContents (webContentsId: number) {
|
|
|
|
return ipcRendererInternal.invoke<string>('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_MEDIA_SOURCE_ID_FOR_WEB_CONTENTS', webContentsId, getCurrentStack());
|
|
|
|
}
|