Handlebars:
Template
{{progress "Search" 10 false}}
{{progress "Upload" 90 true}}
{{progress "Finish" 100 false}}
Preparation-Script
Handlebars.registerHelper('progress', function (name, percent, stalled) {
  var barWidth = percent / 5
  var bar = "********************".slice(0,barWidth)            
  return bar + " " + percent + "% " + name + " " +  (stalled ? "stalled" : "")
})
Input
{}
Output
** 10% Search 
****************** 90% Upload stalled
******************** 100% Finish 
最后更新: 2020/1/11 15:46:21