/
githubmirror
/
ChatGPT
Обзор
Документация
Войти
/
githubmirror
/
ChatGPT
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v2-dev
src/hooks/useInfo.tsx
19 строк
465 B
lencx
chore: main window
20 май 2024, 13:39
20 май 2024, 13:39
1475b0f
Код
Авторство
О чём код?
import { useEffect, useState } from 'react'; import { platform as TauriPlatform } from '@tauri-apps/plugin-os'; export default function useInfo() { const [platform, setPlatform] = useState(''); const [isMac, setMac] = useState(false); const handleInfo = async () => { const p = await TauriPlatform(); setPlatform(await TauriPlatform()); setMac(p === 'macos'); } useEffect(() => { handleInfo(); }, []); return { platform, isMac }; }