« get me outta code hell

tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/util/tui-app.js
diff options
context:
space:
mode:
Diffstat (limited to 'util/tui-app.js')
-rw-r--r--util/tui-app.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/util/tui-app.js b/util/tui-app.js
index a695e57..2f09818 100644
--- a/util/tui-app.js
+++ b/util/tui-app.js
@@ -2,27 +2,26 @@
 // program. Contained to reduce boilerplate and improve consistency between
 // programs.
 
-const ansi = require('./ansi');
+import {Root} from 'tui-lib/ui/primitives'
 
-const CommandLineInterfacer = require('./CommandLineInterfacer');
-const Flushable = require('./Flushable');
-const Root = require('../ui/Root');
+import {CommandLineInterface, Flushable} from './interfaces/index.js'
+import * as ansi from './ansi.js'
 
-module.exports = async function tuiApp(callback) {
-    // TODO: Support other interfacers.
-    const interfacer = new CommandLineInterfacer();
+export default async function tuiApp(callback) {
+    // TODO: Support other screen interfaces.
+    const screenInterface = new CommandLineInterface();
 
     const flushable = new Flushable(process.stdout, true);
 
-    const root = new Root(interfacer);
+    const root = new Root(screenInterface);
 
-    const size = await interfacer.getScreenSize();
+    const size = await screenInterface.getScreenSize();
     root.w = size.width;
     root.h = size.height;
     flushable.resizeScreen(size);
     root.on('rendered', () => flushable.flush());
 
-    interfacer.on('resize', newSize => {
+    screenInterface.on('resize', newSize => {
         root.w = newSize.width;
         root.h = newSize.height;
         flushable.resizeScreen(newSize);