diff options
author | liam4 <towerofnix@gmail.com> | 2017-07-03 18:59:57 -0300 |
---|---|---|
committer | liam4 <towerofnix@gmail.com> | 2017-07-03 19:00:01 -0300 |
commit | 769413468e88acba1a180baa0113139d929a3b9f (patch) | |
tree | f29af36826077178259b7bcc8bf9927cebfe71e3 /examples/interfacer-command-line.js | |
parent | 489e4d0c78d5f393729cda0e1f6ac9a0a1237b4a (diff) |
A long-due cleanup + examples + things
..Obviously this breaks old things (particularly, see changes in FocusElement).
Diffstat (limited to 'examples/interfacer-command-line.js')
-rw-r--r-- | examples/interfacer-command-line.js | 24 |
1 files changed, 24 insertions, 0 deletions
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) +}) |