zoukankan      html  css  js  c++  java
  • 使用blessed-contrib 开发专业的终端dashboard

    blessed-contrib 是blessed 的一个扩展包,以前有说过blessed(一个方便的开发cli 的工具)
    我们使用blessed-contrib可以开发专业的终端dashboard 功能强大,组件丰富

    以下是来自官方demo的一个有运行

    clone 代码

    git clone https://github.com/yaronn/blessed-contrib
     

    安装依赖

    cd blessed-contrib 
    yarn
     

    运行demo

    node examples/dashboard.js
     

    效果:

    代码说明

    使用过程中为了更新使用了setInterval,同时在定时函数中添加更新数据 ,同时为了界面的resize, 添加了resize 方法:

    screen.on('resize', function() {
      donut.emit('attach');
      gauge.emit('attach');
      gauge_two.emit('attach');
      sparkline.emit('attach');
      bar.emit('attach');
      table.emit('attach');
      lcdLineOne.emit('attach');
      errorsLine.emit('attach');
      transactionsLine.emit('attach');
      map.emit('attach');
      log.emit('attach');
    });
    screen.render();
     
     

    说明

    blessed-contrib 是一个很强大的工具 ,很方便

    参考资料

    https://github.com/yaronn/blessed-contrib

  • 相关阅读:
    PHP开发APP接口(九)
    C#深入理解类型
    C#从委托、lambda表达式到linq总结
    C# ==和Equals()
    C# 泛型
    C# Reflection
    原声JS网络请求
    JavaScript预编译
    泛型初探
    C#内存分配
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/11657349.html
Copyright © 2011-2022 走看看