refactor: ginify NativeImage (#24486)

This commit is contained in:
Jeremy Rose 2020-07-13 14:44:12 -07:00 committed by GitHub
parent f0a0e10bd1
commit 36bd940bc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 28 deletions

View file

@ -8,7 +8,6 @@ import { commonModuleList } from '@electron/internal/common/api/module-list';
const v8Util = process._linkedBinding('electron_common_v8_util');
const { hasSwitch } = process._linkedBinding('electron_common_command_line');
const { NativeImage } = process._linkedBinding('electron_common_native_image');
const callbacksRegistry = new CallbacksRegistry();
const remoteObjectCache = new Map();
@ -59,7 +58,7 @@ function wrapArgs (args: any[], visited = new Set()): any {
};
}
if (value instanceof NativeImage) {
if (value && value.constructor && value.constructor.name === 'NativeImage') {
return { type: 'nativeimage', value: serialize(value) };
} else if (Array.isArray(value)) {
visited.add(value);