Created
July 12, 2018 14:28
-
-
Save li0nel/77b828979cb6bd7f9f47c036674a4d67 to your computer and use it in GitHub Desktop.
supportsWebp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var supportsWebp = async function() { | |
if (!self.createImageBitmap) return false; | |
const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; | |
const blob = await fetch(webpData).then(r => r.blob()); | |
return createImageBitmap(blob).then(() => true, () => false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment