9 lines
316 B
TypeScript
9 lines
316 B
TypeScript
|
export async function supportsWebP(): Promise<boolean> {
|
||
|
if(!window.createImageBitmap) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
const data = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="
|
||
|
const blob = await fetch(data).then(r => r.blob())
|
||
|
return createImageBitmap(blob).then(() => true, () => false)
|
||
|
}
|