supports-avif
v1.0.0
Published
Detect support for AVIF images in the browser
Downloads
7
Maintainers
Readme
supports-avif
Same as supports-webp, but for avif
Install
pnpm add supports-avif
Or you can use npm or yarn.
Usage
import supportsAvif from 'supports-avif';
// supportsAvif is a Promise
supportsAvif.then((isSupported) => document.body.classList.toggle('avif', isSupported));
// Or use async/await:
if (await supportsAvif) {
console.log('Load AVIF!');
} else {
console.log('Load WEBP!');
}