`Platform`配下のプロパティで判定する。 ## 挙動 | プロパティ | DDW | DDN | DMW | DMN | MW | MN | | ------------ | -------- | -------- | -------- | -------- | -------- | -------- | | isDesktop | **true** | **true** | false | false | false | false | | isMobile | false | false | **true** | **true** | **true** | **true** | | isDesktopApp | **true** | **true** | **true** | **true** | false | false | | isMobileApp | false | false | false | false | **true** | **true** | | isPhone | false | false | false | **true** | false | **true** | | isTablet | false | false | **true** | false | **true** | false | 列の定義は[[#対象の定義]]を参照。 ## 対象の定義 | 対象(列) | 起動環境 | emulateMobile(???) | 横幅 | | ---- | ---- | ---- | ---- | | DDW | デスクトップ | false | 広い | | DDN | デスクトップ | false | 狭い(スマホ想定) | | DMW | デスクトップ | true | 広い | | DMN | デスクトップ | true | 狭い(スマホ想定) | | MW | モバイルアプリ | | 広い(タブレット想定) | | MN | モバイルアプリ | | 狭い(スマホ想定) | ## [[obsidian.d.ts]]の定義 v1.4.11時点。 ```ts /** @public */ export const Platform: { /** * The UI is in desktop mode. * @public */ isDesktop: boolean; /** * The UI is in mobile mode. * @public */ isMobile: boolean; /** * We're running the electron-based desktop app. * @public */ isDesktopApp: boolean; /** * We're running the capacitor-js mobile app. * @public */ isMobileApp: boolean; /** * We're running the iOS app. * @public */ isIosApp: boolean; /** * We're running the Android app. * @public */ isAndroidApp: boolean; /** * We're in a mobile app that has very limited screen space. * @public */ isPhone: boolean; /** * We're in a mobile app that has sufficiently large screen space. * @public */ isTablet: boolean; /** * We're on a macOS device, or a device that pretends to be one (like iPhones and iPads). * Typically used to detect whether to use command-based hotkeys vs ctrl-based hotkeys. * @public */ isMacOS: boolean; /** * We're on a Windows device. * @public */ isWin: boolean; /** * We're on a Linux device. * @public */ isLinux: boolean; /** * We're running in Safari. * Typically used to provide workarounds for Safari bugs. * @public */ isSafari: boolean; /** * The path prefix for resolving local files on this platform. * This returns: * - `file:///` on mobile * - `app://random-id/` on desktop (Replaces the old format of `app://local/`) * @public */ resourcePathPrefix: string; }; ```