neo-neo-bblessed
Version:
A fork of neo-blessed (which is a fork of blessed) with bug fixes and maintenance.
3 lines (2 loc) • 1.45 kB
JavaScript
const u=require("./node"),f=require("./box");function r(s){if(!(this instanceof u))return new r(s);s=s||{},s.tags=!0,f.call(this,s)}r.prototype.__proto__=f.prototype,r.prototype.type="message",r.prototype.log=r.prototype.display=function(s,o,t){const e=this;if(typeof o=="function"&&(t=o,o=null),o==null&&(o=3),this.scrollable&&(this.screen.saveFocus(),this.focus(),this.scrollTo(0)),this.show(),this.setContent(s),this.screen.render(),o===1/0||o===-1||o===0){const i=function(){if(!i.done){if(i.done=!0,e.scrollable)try{e.screen.restoreFocus()}catch(a){}e.hide(),e.screen.render(),t&&t()}};setTimeout(function(){e.onScreenEvent("keypress",function a(c,n){n.name!=="mouse"&&(e.scrollable&&(n.name==="up"||e.options.vi&&n.name==="k"||n.name==="down"||e.options.vi&&n.name==="j"||e.options.vi&&n.name==="u"&&n.ctrl||e.options.vi&&n.name==="d"&&n.ctrl||e.options.vi&&n.name==="b"&&n.ctrl||e.options.vi&&n.name==="f"&&n.ctrl||e.options.vi&&n.name==="g"&&!n.shift||e.options.vi&&n.name==="g"&&n.shift)||e.options.ignoreKeys&&e.options.ignoreKeys.indexOf(n.name)!==-1||(e.removeScreenEvent("keypress",a),i()))}),e.options.mouse&&e.onScreenEvent("mouse",function a(c){c.action!=="mousemove"&&(e.removeScreenEvent("mouse",a),i())})},10);return}setTimeout(function(){e.hide(),e.screen.render(),t&&t()},o*1e3)},r.prototype.error=function(s,o,t){return this.display("{red-fg}Error: "+s+"{/red-fg}",o,t)},module.exports=r;
//# sourceMappingURL=message.js.map