mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-20 13:22:07 +03:00
21 lines
572 B
TypeScript
21 lines
572 B
TypeScript
|
import { Terminal } from 'xterm';
|
||
|
import { FitAddon } from 'xterm-addon-fit';
|
||
|
|
||
|
import { createState } from "../src/logic/state/base";
|
||
|
|
||
|
type Session = { term: Terminal, fit: FitAddon };
|
||
|
type Sessions = { [id: string]: Session; }
|
||
|
|
||
|
export interface TermState {
|
||
|
sessions: Sessions,
|
||
|
selected: string,
|
||
|
slogstream: null | EventSource,
|
||
|
};
|
||
|
|
||
|
const useTermState = createState<TermState>('Term', {
|
||
|
sessions: {},
|
||
|
selected: '', // empty string is default session
|
||
|
slogstream: null,
|
||
|
}, ['sessions', 'slogstream']); //TODO consider persisting
|
||
|
|
||
|
export default useTermState;
|