* webp convert @frontend * 0.85 → 0.90 --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
11 lines
340 B
TypeScript
11 lines
340 B
TypeScript
let isWebpSupportedCache: boolean | undefined;
|
|
export function isWebpSupported() {
|
|
if (isWebpSupportedCache === undefined) {
|
|
const canvas = document.createElement('canvas');
|
|
canvas.width = 1;
|
|
canvas.height = 1;
|
|
isWebpSupportedCache = canvas.toDataURL('image/webp').startsWith('data:image/webp');
|
|
}
|
|
return isWebpSupportedCache;
|
|
}
|