'resize' 事件


只要 writeStream.columnswriteStream.rows 属性发生更改,就会触发 'resize' 事件。 调用时,没有参数传递给监听器回调。

process.stdout.on('resize', () => {
  console.log('屏幕大小已经改变');
  console.log(`${process.stdout.columns}x${process.stdout.rows}`);
});

The 'resize' event is emitted whenever either of the writeStream.columns or writeStream.rows properties have changed. No arguments are passed to the listener callback when called.

process.stdout.on('resize', () => {
  console.log('screen size has changed!');
  console.log(`${process.stdout.columns}x${process.stdout.rows}`);
});