-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ttd bid adapter: configurable endpoint (#12004)
* support endpoint params for ttd adapter * update to support http2 endpoint only * remove dup code * add missing file * fix battr issue * fix warning * update connection type * add 5g --------- Co-authored-by: Tong Wu <[email protected]>
- Loading branch information
Showing
4 changed files
with
58 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Returns the type of connection. | ||
* | ||
* @returns {number} - Type of connection. | ||
*/ | ||
export function getConnectionType() { | ||
const connection = navigator.connection || navigator.webkitConnection; | ||
if (!connection) { | ||
return 0; | ||
} | ||
switch (connection.type) { | ||
case 'ethernet': | ||
return 1; | ||
case 'wifi': | ||
return 2; | ||
case 'wimax': | ||
return 6; | ||
default: | ||
switch (connection.effectiveType) { | ||
case 'slow-2g': | ||
case '2g': | ||
return 4; | ||
case '3g': | ||
return 5; | ||
case '4g': | ||
return 6; | ||
case '5g': | ||
return 7; | ||
default: | ||
return connection.type == 'cellular' ? 3 : 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters