Skip to content

Commit

Permalink
Refactor: Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
dieulot committed Feb 16, 2023
1 parent 44364a9 commit 4d9dcb4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions instantpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const DELAY_TO_NOT_BE_CONSIDERED_A_TOUCH_INITIATED_ACTION = 1111

let _delayOnHover = 65

let chromiumMajorVersionClientHint = null
let _chromiumMajorVersionClientHint = null

init()

Expand Down Expand Up @@ -44,15 +44,15 @@ function init() {
if (navigator.userAgentData) {
navigator.userAgentData.brands.forEach(({brand, version}) => {
if (brand == 'Chromium') {
chromiumMajorVersionClientHint = parseInt(version)
_chromiumMajorVersionClientHint = parseInt(version)
}
})
}
// `navigator.userAgentData` is available in Chromium 90+,
// though it was not enabled for everyone at first.
// So it’s only reliable for Chromium ~100+, and only on HTTPS or localhost.

if (handleVaryAcceptHeader && chromiumMajorVersionClientHint && chromiumMajorVersionClientHint < 110) {
if (handleVaryAcceptHeader && _chromiumMajorVersionClientHint && _chromiumMajorVersionClientHint < 110) {
return
}

Expand Down Expand Up @@ -266,7 +266,7 @@ function isPreloadable(anchorElement) {

if (anchorElement.origin != location.origin) {
let allowed = _allowExternalLinks || 'instant' in anchorElement.dataset
if (!allowed || !chromiumMajorVersionClientHint) {
if (!allowed || !_chromiumMajorVersionClientHint) {
// Chromium-only: see comment on “restrictive prefetch”
return
}
Expand Down

0 comments on commit 4d9dcb4

Please sign in to comment.