UNPKG

minigame-std

Version:

Mini Game Standard Development Library.

20 lines (18 loc) 583 B
import { isMinaEnv } from '../../macros/env.ts'; export * from './target.ts'; /** * 获取窗口信息。 * @returns */ export function getWindowInfo(): Pick<WechatMinigame.WindowInfo, 'pixelRatio' | 'screenHeight' | 'screenTop' | 'screenWidth' | 'windowHeight' | 'windowWidth'> { return isMinaEnv() ? wx.getWindowInfo() : { pixelRatio: devicePixelRatio, screenHeight: screen.height, screenTop, screenWidth: screen.width, windowHeight: innerHeight, windowWidth: innerWidth, }; }