每次更改样式时都应该调用screen.render()吗?

时间:2019-05-28 13:47:19

标签: node.js tui blessed

我正在使用https://github.com/chjj/blessed并具有以下代码:

navList.on('focus', function() {
  navList.style.border.fg = 'green'; 
  screen.render(); 
});

navList.on('blur', function() {
  navList.style.border.fg = 'white'; 
  screen.render(); 
});

detailBox.on('focus', function() {
  detailBox.style.border.fg = 'green'; 
  screen.render(); 
});

detailBox.on('blur', function() { 
  detailBox.style.border.fg = 'white'; 
  screen.render(); 
});

在我添加screen.render()之前,边框颜色的变化要等到下一次重绘时才会显示,通常在用户按下某个键或单击其他位置时发生。

该代码有效,但是screen.render()是显示边框颜色变化的最佳方法吗?

0 个答案:

没有答案
相关问题