Skip to content

Commit cbe616a

Browse files
committed
revert multi-if statement
1 parent 06a9a0a commit cbe616a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/prefetch.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ function prefetcher(url, isPriority) {
110110
}
111111

112112
if ('connection' in navigator) {
113-
// Don't prefetch if the user is on 2G or if Save-Data is enabled...
114-
if ((navigator.connection.effectiveType || '').includes('2g') || navigator.connection.saveData) return;
113+
// Don't prefetch if the user is on 2G...
114+
if ((navigator.connection.effectiveType || '').includes('2g')) {
115+
return;
116+
}
117+
// Don't prefetch ifSave-Data is enabled...
118+
if (navigator.connection.saveData) {
119+
return;
120+
}
115121
}
116122

117123
// Wanna do something on catch()?

0 commit comments

Comments
 (0)