overleaf/services/web/frontend/js/features/pdf-preview/util/pdf-caching-flags.js
Timothée Alby 8841c8c874 Merge pull request #9008 from overleaf/jpa-disable-pdf-caching-edge-legacy
[web] disable pdf caching feature in legacy Edge browser

GitOrigin-RevId: f57ca3385337b5516e27a701646f2ed92325bf8d
2022-07-29 08:04:10 +00:00

14 lines
472 B
JavaScript

import getMeta from '../../../utils/meta'
const hasTextEncoder = typeof TextEncoder !== 'undefined'
if (!hasTextEncoder) {
console.warn('TextEncoder is not available. Disabling pdf-caching.')
}
function isFlagEnabled(flag) {
if (!hasTextEncoder) return false
return getMeta('ol-splitTestVariants')?.[flag] === 'enabled'
}
export const enablePdfCaching = isFlagEnabled('pdf-caching-mode')
export const trackPdfDownloadEnabled = isFlagEnabled('track-pdf-download')