smartlog-destination-local/dist/beautylog.classes.ora.js
2016-07-24 01:17:38 +02:00

54 lines
3.2 KiB
JavaScript

"use strict";
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
});
startArg ? this._oraObject.start() : void (0);
}
text(textArg) {
this._oraObject.text = textArg;
}
;
start(textArg, colorArg) {
if (textArg)
this._oraObject.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;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMub3JhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5bG9nLmNsYXNzZXMub3JhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsTUFBWSxPQUFPLFdBQU0scUJBQXFCLENBQUMsQ0FBQTtBQUMvQyx3Q0FBc0IseUJBQXlCLENBQUMsQ0FBQTtBQUVyQyxpQkFBUyxHQUFXLEtBQUssQ0FBQyxDQUFDLHFEQUFxRDtBQUczRjtJQUdJLFlBQVksT0FBYyxFQUFDLFFBQWUsRUFBQyxRQUFRLEdBQVcsS0FBSztRQUMvRCxJQUFJLENBQUMsVUFBVSxHQUFHLE9BQU8sQ0FB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