perf: use type-utils for desktopCapturer.getSources() result serialization (#23549)
This commit is contained in:
parent
508c7ac4f9
commit
85fae67966
5 changed files with 11 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
import { nativeImage } from 'electron';
|
||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||
import { deserialize } from '@electron/internal/common/type-utils';
|
||||
|
||||
const { hasSwitch } = process.electronBinding('command_line');
|
||||
|
||||
|
@ -35,11 +35,5 @@ export async function getSources (options: Electron.SourcesOptions) {
|
|||
fetchWindowIcons
|
||||
} as ElectronInternal.GetSourcesOptions, getCurrentStack());
|
||||
|
||||
return sources.map(source => ({
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
thumbnail: nativeImage.createFromDataURL(source.thumbnail),
|
||||
display_id: source.display_id,
|
||||
appIcon: source.appIcon ? nativeImage.createFromDataURL(source.appIcon) : null
|
||||
}));
|
||||
return deserialize(sources);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue