mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
ed66b43979
[web] optimize pdf caching GitOrigin-RevId: 85f8b8425ca0052b0d5229cec651e1d5080f1da4
19 lines
716 B
JavaScript
19 lines
716 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 cachedUrlLookupEnabled = isFlagEnabled(
|
|
'pdf-caching-cached-url-lookup'
|
|
)
|
|
export const prefetchingEnabled = isFlagEnabled('pdf-caching-prefetching')
|
|
export const prefetchLargeEnabled = isFlagEnabled('pdf-caching-prefetch-large')
|
|
export const enablePdfCaching = isFlagEnabled('pdf-caching-mode')
|
|
export const trackPdfDownloadEnabled = isFlagEnabled('track-pdf-download')
|