/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
apps/examples/src/hooks/usePerformance.ts
23 строки
614 B
Mime Čuvalo
chore(tooling): migrate lint and formatting to oxlint and oxfmt (#8258)
19 мар 2026, 17:55
Не верифицирован
19 мар 2026, 17:55
370d3a8
Код
Авторство
О чём код?
import { TLUiEventSource, TLUiOverrides, debugFlags, measureCbDuration, useValue } from 'tldraw' export function usePerformance(): TLUiOverrides { const measurePerformance = useValue( 'measurePerformance', () => debugFlags.measurePerformance.get(), [debugFlags] ) if (!measurePerformance) return {} return { actions(_editor, actions) { Object.keys(actions).forEach((key) => { const action = actions[key] const cb = action.onSelect action.onSelect = (source: TLUiEventSource) => { return measureCbDuration(`Action ${key}`, () => cb(source)) } }) return actions }, } }