From 769413468e88acba1a180baa0113139d929a3b9f Mon Sep 17 00:00:00 2001 From: liam4 Date: Mon, 3 Jul 2017 18:59:57 -0300 Subject: A long-due cleanup + examples + things ..Obviously this breaks old things (particularly, see changes in FocusElement). --- examples/interfacer-command-line.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples/interfacer-command-line.js (limited to 'examples/interfacer-command-line.js') diff --git a/examples/interfacer-command-line.js b/examples/interfacer-command-line.js new file mode 100644 index 0000000..1da6adf --- /dev/null +++ b/examples/interfacer-command-line.js @@ -0,0 +1,24 @@ +const Root = require('../ui/Root') +const CommandLineInterfacer = require('../util/CommandLineInterfacer') +const AppElement = require('./basic-app') + +const interfacer = new CommandLineInterfacer() + +interfacer.getScreenSize().then(size => { + const root = new Root(interfacer) + root.w = size.width + root.h = size.height + + const appElement = new AppElement() + root.addChild(appElement) + root.select(appElement) + + appElement.on('quitRequested', () => { + process.exit(0) + }) + + setInterval(() => root.render(), 100) +}).catch(error => { + console.error(error) + process.exit(1) +}) -- cgit 1.3.0-6-gf8a5