From 12ea120dba62d22e27badd4286f2310f0bc5990c Mon Sep 17 00:00:00 2001 From: Florrie Date: Wed, 30 May 2018 15:04:11 -0300 Subject: Interactivity --- index.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'index.js') diff --git a/index.js b/index.js index a86918a..635426e 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,11 @@ const EventEmitter = require('events') const Flushable = require('./tui-lib/util/Flushable') const Root = require('./tui-lib/ui/Root') +process.on('unhandledRejection', error => { + console.error(error.stack) + process.exit(1) +}) + class InternalApp extends EventEmitter { constructor() { super() @@ -45,10 +50,10 @@ class InternalApp extends EventEmitter { } async function main() { + /* const internalApp = new InternalApp() await internalApp.setup() - /* await internalApp.startPlaying('http://billwurtz.com/cable-television.mp3') await new Promise(r => setTimeout(r, 2000)) internalApp.togglePause() @@ -82,6 +87,8 @@ async function main() { root.addChild(appElement) root.select(appElement) + await appElement.setup() + appElement.on('quitRequested', () => { process.stdout.write(ansi.cleanCursor()) process.exit(0) @@ -89,14 +96,17 @@ async function main() { const grouplike = { items: [ - {name: 'Nice'}, - {name: 'W00T!'}, - {name: 'All-star'} + {name: 'alphabet shuffle', downloaderArg: 'http://www.billwurtz.com/alphabet-shuffle.mp3'}, + {name: 'in california', downloaderArg: 'http://www.billwurtz.com/in-california.mp3'}, + {name: 'i love you', downloaderArg: 'http://www.billwurtz.com/i-love-you.mp3'}, + {name: 'movie star', downloaderArg: 'http://www.billwurtz.com/movie-star.mp3'}, + {name: 'got to know what\'s going on', downloaderArg: 'http://www.billwurtz.com/got-to-know-whats-going-on.mp3'}, + {name: 'outside', downloaderArg: 'http://www.billwurtz.com/outside.mp3'}, + {name: 'La de da de da de da de day oh', downloaderArg: 'http://www.billwurtz.com/la-de-da-de-da-de-da-de-day-oh.mp3'}, + {name: 'and the day goes on', downloaderArg: 'http://www.billwurtz.com/and-the-day-goes-on.mp3'} ] } - appElement.recordStore.getRecord(grouplike.items[2]).downloading = true - appElement.grouplikeListingElement.loadGrouplike(grouplike) root.select(appElement.grouplikeListingElement) -- cgit 1.3.0-6-gf8a5