UNPKG

@vnmfify/core

Version:

```shell npm i @vnmfify/core -S ```

32 lines (31 loc) 711 B
import { getSystemInfo } from "@vnxjs/vnmf"; import { useState } from "react"; import { useMounted } from "../hooks"; var INITIAL_RECT = { screenHeight: 0, screenWidth: 0, windowHeight: 0, windowWidth: 0 }; export function getSystemRect() { return getSystemInfo().then(_ref => { var { screenHeight, screenWidth, windowHeight, windowWidth } = _ref; return { screenHeight, screenWidth, windowHeight, windowWidth }; }); } export function useSystemRect() { var [rect, setRect] = useState(INITIAL_RECT); useMounted(() => getSystemRect().then(setRect)); return rect; } //# sourceMappingURL=system.js.map