fix: NativeImage serialization of <webview>.capturePage() result (#20825)
This commit is contained in:
parent
c0657a4ca7
commit
1d596f616d
12 changed files with 67 additions and 44 deletions
|
@ -1,26 +0,0 @@
|
|||
export function isPromise (val: any) {
|
||||
return (
|
||||
val &&
|
||||
val.then &&
|
||||
val.then instanceof Function &&
|
||||
val.constructor &&
|
||||
val.constructor.reject &&
|
||||
val.constructor.reject instanceof Function &&
|
||||
val.constructor.resolve &&
|
||||
val.constructor.resolve instanceof Function
|
||||
)
|
||||
}
|
||||
|
||||
const serializableTypes = [
|
||||
Boolean,
|
||||
Number,
|
||||
String,
|
||||
Date,
|
||||
Error,
|
||||
RegExp,
|
||||
ArrayBuffer
|
||||
]
|
||||
|
||||
export function isSerializableObject (value: any) {
|
||||
return value === null || ArrayBuffer.isView(value) || serializableTypes.some(type => value instanceof type)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue