You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
785 B
15 lines
785 B
/** True when running inside the packaged Electron shell ({@link electron/preload.cjs}). */ |
|
export function isImwaldElectron(): boolean { |
|
return typeof window !== 'undefined' && window.imwaldElectron?.isElectron === true |
|
} |
|
|
|
/** |
|
* Coarse “phone / mobile browser” profile: touch-first or narrow viewport, excluding Electron. |
|
* Used for smaller in-memory LRU and tighter disk archive defaults (not a substitute for real UA tests). |
|
*/ |
|
export function isMobileBrowserProfile(): boolean { |
|
if (typeof window === 'undefined' || isImwaldElectron()) return false |
|
const narrow = window.matchMedia?.('(max-width: 768px)')?.matches ?? false |
|
const coarse = window.matchMedia?.('(pointer: coarse)')?.matches ?? false |
|
return narrow || (coarse && (window.innerWidth ?? 1024) <= 900) |
|
}
|
|
|