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;
|
/**
|
||||||
try {
|
* DON'T OPTIMIZE, don't change this to a const or let, it needs to be a var.
|
||||||
parsedUA = Bowser.parse(navigator.userAgent);
|
*/
|
||||||
} catch {
|
var parsedUA = null;
|
||||||
// In case the user agent is an empty string or Bowser can't parse it for some other reason
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function getParsedUA() {
|
||||||
|
if (!parsedUA) {
|
||||||
|
try {
|
||||||
|
parsedUA = Bowser.parse(navigator.userAgent);
|
||||||
|
} catch {
|
||||||
|
// 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