/
githubmirror
/
hyper
Обзор
Документация
Войти
/
githubmirror
/
hyper
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
lib/store/write-middleware.ts
19 строк
594 B
Labhansh Agrawal
sort imports
25 июл 2023, 21:46
25 июл 2023, 21:46
36ff6e9
Код
Авторство
О чём код?
import type {Dispatch, Middleware} from 'redux'; import type {HyperActions, HyperState} from '../../typings/hyper'; import terms from '../terms'; // the only side effect we perform from middleware // is to write to the react term instance directly // to avoid a performance hit const writeMiddleware: Middleware<{}, HyperState, Dispatch<HyperActions>> = () => (next) => (action: HyperActions) => { if (action.type === 'SESSION_PTY_DATA') { const term = terms[action.uid]; if (term) { term.term.write(action.data); } } next(action); }; export default writeMiddleware;