supports-avif
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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!');
}

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i supports-avif

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • baileys-li