@giphy/js-util 0.0.0-canary-20230620165510
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/index.cjs +365 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +320 -0
- package/package.json +46 -0
- package/src/__tests__/.eslintrc +5 -0
- package/src/__tests__/gif-utils.test.ts +167 -0
- package/src/__tests__/git-util-best-rendition.test.ts +304 -0
- package/src/bestfit.ts +64 -0
- package/src/collections.ts +36 -0
- package/src/get-client-rect-from-el.ts +29 -0
- package/src/get-pingback-id.ts +42 -0
- package/src/gif-utils.ts +127 -0
- package/src/index.ts +16 -0
- package/src/log.ts +36 -0
- package/src/sdk-headers.ts +18 -0
- package/src/webp-check.ts +18 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export let SUPPORTS_WEBP: null | boolean = null
|
|
2
|
+
/* istanbul ignore next */
|
|
3
|
+
export const checkIfWebP = new Promise(resolve => {
|
|
4
|
+
if (typeof Image === 'undefined') {
|
|
5
|
+
resolve(false)
|
|
6
|
+
}
|
|
7
|
+
const webp = new Image()
|
|
8
|
+
webp.onload = () => {
|
|
9
|
+
SUPPORTS_WEBP = true
|
|
10
|
+
resolve(SUPPORTS_WEBP)
|
|
11
|
+
}
|
|
12
|
+
webp.onerror = () => {
|
|
13
|
+
SUPPORTS_WEBP = false
|
|
14
|
+
resolve(SUPPORTS_WEBP)
|
|
15
|
+
}
|
|
16
|
+
webp.src =
|
|
17
|
+
'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'
|
|
18
|
+
})
|