mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
resize delay.
This commit is contained in:
parent
0950c7e62e
commit
2b15290021
@ -280,7 +280,7 @@ function Screen(options) {
|
||||
|
||||
this.alloc();
|
||||
|
||||
this.program.on('resize', function() {
|
||||
function resize() {
|
||||
self.alloc();
|
||||
self.render();
|
||||
(function emit(el) {
|
||||
@ -290,6 +290,20 @@ function Screen(options) {
|
||||
}
|
||||
})(self);
|
||||
// self.emitDescendants('resize');
|
||||
}
|
||||
|
||||
this.program.on('resize', function() {
|
||||
if (!self.options.resizeTimeout) {
|
||||
return resize();
|
||||
}
|
||||
if (self._resizeTimer) {
|
||||
clearTimeout(self._resizeTimer);
|
||||
delete self._resizeTimer;
|
||||
}
|
||||
var time = typeof self.options.resizeTimeout === 'number'
|
||||
? self.options.resizeTimeout
|
||||
: 300;
|
||||
self._resizeTimer = setTimeout(resize, time);
|
||||
});
|
||||
|
||||
this.program.alternateBuffer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user