55 lines
3.3 KiB
JavaScript
55 lines
3.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
require("typings-global");
|
|
const plugins = require("./beautylog.plugins");
|
|
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
|
|
exports.oraActive = false; // when an Ora is active (e.g. start()) this is true
|
|
class Ora {
|
|
constructor(textArg, colorArg, startArg = false) {
|
|
this._oraObject = plugins.ora({
|
|
spinner: 'dots',
|
|
text: textArg,
|
|
color: colorArg
|
|
});
|
|
if (startArg) {
|
|
this.start();
|
|
}
|
|
}
|
|
text(textArg) {
|
|
this._oraObject.text = textArg;
|
|
}
|
|
start(textArg, colorArg) {
|
|
if (textArg) {
|
|
this.text(textArg);
|
|
}
|
|
if (colorArg) {
|
|
this._oraObject.color = colorArg;
|
|
}
|
|
exports.activeOra = this;
|
|
exports.oraActive = true;
|
|
this._oraObject.start();
|
|
}
|
|
end() {
|
|
this._oraObject.stop();
|
|
this._oraObject.clear();
|
|
exports.activeOra = undefined;
|
|
exports.oraActive = false;
|
|
}
|
|
endOk(textArg) {
|
|
this.end();
|
|
beautylog_log_helpers_1.logNode('ok', textArg);
|
|
}
|
|
endError(textArg) {
|
|
this.end();
|
|
beautylog_log_helpers_1.logNode('error', textArg);
|
|
}
|
|
pause() {
|
|
this._oraObject.stop();
|
|
}
|
|
stop() {
|
|
this.end();
|
|
}
|
|
}
|
|
exports.Ora = Ora;
|
|
exports.ora = new Ora('init...', 'blue', false);
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMub3JhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5bG9nLmNsYXNzZXMub3JhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMEJBQXVCO0FBQ3ZCLCtDQUE4QztBQUM5QyxtRUFBaUQ7QUFFdEMsU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