Handlebars
模板
{{progress "Search" 10 false}}
{{progress "Upload" 90 true}}
{{progress "Finish" 100 false}}
准备脚本
Handlebars.registerHelper('progress', function (name, percent, stalled) {
  var barWidth = percent / 5
  var bar = "********************".slice(0,barWidth)            
  return bar + " " + percent + "% " + name + " " +  (stalled ? "stalled" : "")
})
输入
{}
输出
** 10% Search 
****************** 90% Upload stalled
******************** 100% Finish 
最后更新: 2019 年 8 月 2 日,下午 10:34:22