@atlassian/terminal-dispatch-state
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

terminal-dispatch-state

Build dynamic terminal interfaces by updating the state.

API

import { Store } from '@atlassian/terminal-dispatch-state';
import ora from 'ora'; // if you want to show a spinner

const 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 object

const newState = [...state];
store.update(newState); // adds one line

const spinner = ora('Loading unicorns');
const newStateWithUnicorns = [
  ...newState,
  { spinner, isRunning: true }
]
store.update([...newState, progress]); // adds ora spinner with text

store.stop();

Package Sidebar

Install

npm i @atlassian/terminal-dispatch-state

Weekly Downloads

3

Version

0.0.2

License

MIT

Unpacked Size

12.4 kB

Total Files

6

Last publish

Collaborators

  • kbielaski
  • dwalker
  • atlassian-aui
  • jvdl
  • mdejongh
  • mszczepanski
  • cdarroch
  • macku
  • dboyd
  • dmorrow
  • mstaas
  • cwhittington
  • doklovic
  • 1999-atlassian
  • amcculloch
  • wyasvoin
  • jmoynihan
  • xqiu
  • gleal-atlassian
  • mszpyra
  • bcytrowski
  • plai1
  • sraj
  • tilwin_atlassian
  • mrzymski
  • media-build-bot
  • akishore
  • timse
  • mkem114
  • tsebastian
  • sfp-release-bot