build: enable JS semicolons (#22783)

This commit is contained in:
Samuel Attard 2020-03-20 13:28:31 -07:00 committed by GitHub
parent 24e21467b9
commit 5d657dece4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
354 changed files with 21512 additions and 21510 deletions

View file

@ -1,39 +1,39 @@
import { nativeImage } from 'electron'
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'
import { nativeImage } from 'electron';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
const { hasSwitch } = process.electronBinding('command_line')
const { hasSwitch } = process.electronBinding('command_line');
// |options.types| can't be empty and must be an array
function isValid (options: Electron.SourcesOptions) {
const types = options ? options.types : undefined
return Array.isArray(types)
const types = options ? options.types : undefined;
return Array.isArray(types);
}
const enableStacks = hasSwitch('enable-api-filtering-logging')
const enableStacks = hasSwitch('enable-api-filtering-logging');
function getCurrentStack () {
const target = {}
const target = {};
if (enableStacks) {
Error.captureStackTrace(target, getCurrentStack)
Error.captureStackTrace(target, getCurrentStack);
}
return (target as any).stack
return (target as any).stack;
}
export async function getSources (options: Electron.SourcesOptions) {
if (!isValid(options)) throw new Error('Invalid options')
if (!isValid(options)) throw new Error('Invalid options');
const captureWindow = options.types.includes('window')
const captureScreen = options.types.includes('screen')
const captureWindow = options.types.includes('window');
const captureScreen = options.types.includes('screen');
const { thumbnailSize = { width: 150, height: 150 } } = options
const { fetchWindowIcons = false } = options
const { thumbnailSize = { width: 150, height: 150 } } = options;
const { fetchWindowIcons = false } = options;
const sources = await ipcRendererInternal.invoke<ElectronInternal.GetSourcesResult[]>('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', {
captureWindow,
captureScreen,
thumbnailSize,
fetchWindowIcons
} as ElectronInternal.GetSourcesOptions, getCurrentStack())
} as ElectronInternal.GetSourcesOptions, getCurrentStack());
return sources.map(source => ({
id: source.id,
@ -41,5 +41,5 @@ export async function getSources (options: Electron.SourcesOptions) {
thumbnail: nativeImage.createFromDataURL(source.thumbnail),
display_id: source.display_id,
appIcon: source.appIcon ? nativeImage.createFromDataURL(source.appIcon) : null
}))
}));
}