docs. better cleanup.

This commit is contained in:
Christopher Jeffrey 2013-06-18 06:30:26 -05:00
parent 787c7c6945
commit ef9178f7d0
2 changed files with 20 additions and 5 deletions

View File

@ -157,7 +157,11 @@ The base node which everything inherits from.
##### Properties:
- inherits all from EventEmitter.
- **options** - original options object.
- **parent** - parent node.
- **screen** - parent screen.
- **children** - array of node's children.
- **data, _, $** - an object for any miscellanous user data.
##### Events:

View File

@ -143,10 +143,25 @@ function Screen(options) {
this.program.alternateBuffer();
this.program.hideCursor();
process.on('exit', function() {
function reset() {
if (reset.done) return;
reset.done = true;
self.program.clear();
self.program.showCursor();
self.program.normalBuffer();
if (self._listenedMouse) {
self.program.disableMouse();
}
}
process.on('uncaughtException', function(err) {
reset();
if (err) console.error(err.stack + '');
return process.exit(0);
});
process.on('exit', function() {
reset();
});
this.on('newListener', function fn(type) {
@ -175,10 +190,6 @@ Screen.prototype._listenMouse = function(el) {
this.program.enableMouse();
process.on('exit', function() {
self.program.disableMouse();
});
//this.on('element click', function(el) {
// el.focus();
//});