overleaf/services/web/frontend/js/features/pdf-preview/util/pdf-caching-flags.js

15 lines
472 B
JavaScript
Raw Normal View History

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')