/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/desktop/src/main/ipc/fonts.ts
21 строка
606 B
Ran Luo
chore: convert repo to pnpm monorepo (packages/desktop, muyajs, website) (#4302)
29 май 2026, 05:25
Не верифицирован
29 май 2026, 05:25
565bfcd
Код
Авторство
О чём код?
import { ipcMain } from 'electron' import log from 'electron-log' interface FontListShape { getFonts?: () => Promise<string[]> default?: { getFonts?: () => Promise<string[]> } } export const registerFontsHandlers = (): void => { ipcMain.handle('mt::fonts::list', async() => { try { const fontList = (await import('font-list')) as FontListShape const getFonts = fontList.getFonts || fontList.default?.getFonts if (typeof getFonts !== 'function') return [] return await getFonts() } catch (err) { log.error('font-list failed:', err) return [] } }) }