https://github.com/1999/terminal-dispatch-state
Re-render terminal contents by updating the state.
https://github.com/1999/terminal-dispatch-state
cli react redux terminal
Last synced: about 2 months ago
JSON representation
Re-render terminal contents by updating the state.
- Host: GitHub
- URL: https://github.com/1999/terminal-dispatch-state
- Owner: 1999
- Created: 2019-09-19T00:47:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-24T16:58:29.000Z (about 3 years ago)
- Last Synced: 2025-03-10T21:24:37.875Z (2 months ago)
- Topics: cli, react, redux, terminal
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## terminal-dispatch-state
Build dynamic terminal interfaces by updating the state.

## API
```javascript
import { Store } from '@atlassian/terminal-dispatch-state';
import ora from 'ora'; // if you want to show a spinnerconst store = new Store();
const state = [
'line1',
'line2',
'line3',
];store.update(state); // renders three lines in the terminal
state.push('line4');
store.update(state); // does not render anything because state is the same objectconst newState = [...state];
store.update(newState); // adds one lineconst spinner = ora('Loading unicorns');
const newStateWithUnicorns = [
...newState,
{ spinner, isRunning: true }
]
store.update([...newState, progress]); // adds ora spinner with textstore.stop();
```