Fix init order in RA mods
This commit is contained in:
parent
3da9fb4efe
commit
16cabb38ad
|
@ -108,13 +108,22 @@ export function humanizeGenTime(total_gen_time) {
|
||||||
return time_spent;
|
return time_spent;
|
||||||
}
|
}
|
||||||
|
|
||||||
let parsedUA = null;
|
/**
|
||||||
|
* DON'T OPTIMIZE, don't change this to a const or let, it needs to be a var.
|
||||||
|
*/
|
||||||
|
var parsedUA = null;
|
||||||
|
|
||||||
|
function getParsedUA() {
|
||||||
|
if (!parsedUA) {
|
||||||
try {
|
try {
|
||||||
parsedUA = Bowser.parse(navigator.userAgent);
|
parsedUA = Bowser.parse(navigator.userAgent);
|
||||||
} catch {
|
} catch {
|
||||||
// In case the user agent is an empty string or Bowser can't parse it for some other reason
|
// In case the user agent is an empty string or Bowser can't parse it for some other reason
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsedUA;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the device is a mobile device.
|
* Checks if the device is a mobile device.
|
||||||
|
@ -123,7 +132,7 @@ try {
|
||||||
export function isMobile() {
|
export function isMobile() {
|
||||||
const mobileTypes = ['mobile', 'tablet'];
|
const mobileTypes = ['mobile', 'tablet'];
|
||||||
|
|
||||||
return mobileTypes.includes(parsedUA?.platform?.type);
|
return mobileTypes.includes(getParsedUA()?.platform?.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function shouldSendOnEnter() {
|
export function shouldSendOnEnter() {
|
||||||
|
|
Loading…
Reference in New Issue