refactor: ginify NativeImage (#24486)
This commit is contained in:
parent
f0a0e10bd1
commit
36bd940bc3
6 changed files with 56 additions and 28 deletions
|
@ -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';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue