resize delay.

This commit is contained in:
Christopher Jeffrey 2013-07-12 21:51:24 -05:00
parent 0950c7e62e
commit 2b15290021

View File

@ -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();