neo-neo-bblessed
Version:
A fork of neo-blessed (which is a fork of blessed) with bug fixes and maintenance.
3 lines (2 loc) • 876 B
JavaScript
const o=require("./node"),i=require("./box"),s=require("./text");function n(t){if(!(this instanceof o))return new n(t);t=t||{},i.call(this,t),this._.icon=new s({parent:this,align:"center",top:2,left:1,right:1,height:1,content:"|"})}n.prototype.__proto__=i.prototype,n.prototype.type="loading",n.prototype.load=function(t){const e=this;this.show(),this.setContent(t),this._.timer&&this.stop(),this.screen.lockKeys=!0,this._.timer=setInterval(function(){e._.icon.content==="|"?e._.icon.setContent("/"):e._.icon.content==="/"?e._.icon.setContent("-"):e._.icon.content==="-"?e._.icon.setContent("\\"):e._.icon.content==="\\"&&e._.icon.setContent("|"),e.screen.render()},200)},n.prototype.stop=function(){this.screen.lockKeys=!1,this.hide(),this._.timer&&(clearInterval(this._.timer),delete this._.timer),this.screen.render()},module.exports=n;
//# sourceMappingURL=loading.js.map