事件:'resize'
¥Event: 'resize'
每当 writeStream.columns
或 writeStream.rows
属性发生更改时,则会触发 'resize'
事件。当调用时,没有参数传给监听器回调。
¥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}`);
});