Skip to content

webp-detector has functions with isSupportWebp and getWebpSrc

Notifications You must be signed in to change notification settings

twobin/webp-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webp-detector

webp-detector has functions with isSupportWebp and getWebpSrc.

isSupportWebp:先将检测结果保存在 localStorage,格式为 WebpDetector: 'available' 或 WebpDetector: 'disable'。

getWebpSrc:根据 localStorage 中的检测结果,如果支持 webp 格式,则图片链接加上后缀,默认为 _.webp。

npm version build status npm downloads

usage

$ npm i -S webp-detector

docs

webp-detector

import webpDetector from 'webp-detector';

webpDetector.isSupportWebp();

<img src={webpDetector.getWebpSrc('xxx')} />

About

webp-detector has functions with isSupportWebp and getWebpSrc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published