command-line-interface.js 584 B

1234567891011121314151617181920212223242526
  1. import {Root} from 'tui-lib/ui/primitives'
  2. import {CommandLineInterface} from 'tui-lib/util/interfaces'
  3. import AppElement from './basic-app.js'
  4. const clInterface = new CommandLineInterface()
  5. clInterface.getScreenSize().then(size => {
  6. const root = new Root(clInterface)
  7. root.w = size.width
  8. root.h = size.height
  9. const appElement = new AppElement()
  10. root.addChild(appElement)
  11. root.select(appElement)
  12. appElement.on('quitRequested', () => {
  13. process.exit(0)
  14. })
  15. setInterval(() => root.render(), 100)
  16. }).catch(error => {
  17. console.error(error)
  18. process.exit(1)
  19. })