mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 09:53:08 +02:00
8a6f73c5ff
* Revert "Revert #8098"
This reverts commit 8b9dc962ae
.
* fix
* use deepClone instead of deepclone
* defaultStore.loaded
* fix load
* wait ready
* use top-level await, await in device-kind.ts
12 lines
493 B
TypeScript
12 lines
493 B
TypeScript
import { defaultStore } from '@/store';
|
|
|
|
await defaultStore.ready;
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
|
const isTablet = /ipad/.test(ua) || (/mobile|iphone|android/.test(ua) && window.innerWidth > 700);
|
|
const isSmartphone = !isTablet && /mobile|iphone|android/.test(ua);
|
|
|
|
export const deviceKind: 'smartphone' | 'tablet' | 'desktop' = defaultStore.state.overridedDeviceKind ? defaultStore.state.overridedDeviceKind
|
|
: isSmartphone ? 'smartphone'
|
|
: isTablet ? 'tablet'
|
|
: 'desktop';
|