Skip to content

Commit 34e9718

Browse files
committed
golf: combine nav.connection if-statements;
- 780 gz / 626 br
1 parent 84a0468 commit 34e9718

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/prefetch.mjs

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

118118
if ('connection' in navigator) {
119-
// Don't prefetch if the user is on 2G..
120-
if ((navigator.connection.effectiveType || '').includes('2g')) {
121-
return;
122-
}
123-
// Don't prefetch if Save-Data is enabled..
124-
if (navigator.connection.saveData) {
125-
return;
126-
}
119+
// Don't prefetch if the user is on 2G or if Save-Data is enabled...
120+
if ((navigator.connection.effectiveType || '').includes('2g') || navigator.connection.saveData) return;
127121
}
128122

129123
// Wanna do something on catch()?

0 commit comments

Comments
 (0)