File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,20 +95,14 @@ const supportedPrefetchStrategy = typeof document !== 'undefined' && support('pr
9595 * @param {Boolean } isPriority - if is "high" priority
9696 * @return {Object } a Promise
9797 */
98- function prefetcher ( url , isPriority ) {
98+ function prefetcher ( url , isPriority , conn ) {
9999 if ( preFetched [ url ] ) {
100100 return ;
101101 }
102102
103- if ( 'connection' in navigator ) {
104- // Don't prefetch if the user is on 2G...
105- if ( ( navigator . connection . effectiveType || '' ) . includes ( '2g' ) ) {
106- return ;
107- }
108- // Don't prefetch if Save-Data is enabled...
109- if ( navigator . connection . saveData ) {
110- return ;
111- }
103+ if ( conn = navigator . connection ) {
104+ // Don't prefetch if the user is on 2G. or if Save-Data is enabled..
105+ if ( ( conn . effectiveType || '' ) . includes ( '2g' ) || conn . saveData ) return ;
112106 }
113107
114108 // Wanna do something on catch()?
You can’t perform that action at this time.
0 commit comments