neo-blessed/test/widget-log.js

48 lines
790 B
JavaScript
Raw Normal View History

2015-03-31 08:31:43 +00:00
var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/logger.log',
smartCSR: true,
autoPadding: false
});
var logger = blessed.log({
parent: screen,
top: 'center',
left: 'center',
width: '50%',
height: '50%',
border: 'line',
tags: true,
keys: true,
vi: true,
mouse: true,
scrollback: 100,
scrollbar: {
ch: ' ',
track: {
bg: 'yellow'
},
style: {
inverse: true
}
}
});
logger.focus();
setInterval(function() {
logger.log('Hello {#0fe1ab-fg}world{/}: {bold}%s{/bold}.', Date.now().toString(36));
2015-03-31 08:31:43 +00:00
if (Math.random() < 0.30) {
logger.log({foo:{bar:{baz:true}}});
}
screen.render();
}, 1000).unref();
screen.key('q', function() {
return process.exit(0);
});
screen.render();