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 type { MetaTypeFromRenderer, ObjectMember, MetaType, ObjProtoDescriptor }
const v8Util = process._linkedBinding('electron_common_v8_util');
const eventBinding = process._linkedBinding('electron_browser_event');
const features = process._linkedBinding('electron_common_features');
const { NativeImage } = process._linkedBinding('electron_common_native_image');
if (!features.isRemoteModuleEnabled()) {
throw new Error('remote module is disabled');
@ -102,7 +101,7 @@ const valueToMeta = function (sender: electron.WebContents, contextId: string, v
// Recognize certain types of objects.
if (value instanceof Buffer) {
type = 'buffer';
} else if (value instanceof NativeImage) {
} else if (value && value.constructor && value.constructor.name === 'NativeImage') {
type = 'nativeimage';
} else if (Array.isArray(value)) {
type = 'array';