fix: NativeImage serialization of <webview>.capturePage() result (#20825)

This commit is contained in:
Milan Burda 2019-11-12 21:56:17 +01:00 committed by Alexey Kuzmin
parent c0657a4ca7
commit 1d596f616d
12 changed files with 67 additions and 44 deletions

View file

@ -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)
}