2016-05-13 23:18:44 +00:00
|
|
|
"use strict";
|
2017-03-11 11:30:18 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2016-05-23 07:10:30 +00:00
|
|
|
require("typings-global");
|
2016-07-23 17:47:23 +00:00
|
|
|
const plugins = require("./beautylog.plugins");
|
|
|
|
const beautylog_log_helpers_1 = require("./beautylog.log.helpers");
|
2016-10-16 00:26:43 +00:00
|
|
|
exports.oraActive = false; // when an Ora is active (e.g. start()) this is true
|
2016-07-23 17:47:23 +00:00
|
|
|
class Ora {
|
|
|
|
constructor(textArg, colorArg, startArg = false) {
|
2016-05-13 23:18:44 +00:00
|
|
|
this._oraObject = plugins.ora({
|
2016-10-16 00:26:43 +00:00
|
|
|
spinner: 'dots',
|
2016-05-13 23:18:44 +00:00
|
|
|
text: textArg,
|
|
|
|
color: colorArg
|
|
|
|
});
|
2017-01-21 18:29:20 +00:00
|
|
|
if (startArg) {
|
|
|
|
this.start();
|
|
|
|
}
|
2016-05-13 23:18:44 +00:00
|
|
|
}
|
2016-07-23 17:47:23 +00:00
|
|
|
text(textArg) {
|
2016-05-13 23:18:44 +00:00
|
|
|
this._oraObject.text = textArg;
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
start(textArg, colorArg) {
|
2016-10-16 00:26:43 +00:00
|
|
|
if (textArg) {
|
2017-01-21 18:29:20 +00:00
|
|
|
this.text(textArg);
|
2016-10-16 00:26:43 +00:00
|
|
|
}
|
|
|
|
if (colorArg) {
|
2016-05-14 15:51:35 +00:00
|
|
|
this._oraObject.color = colorArg;
|
2016-10-16 00:26:43 +00:00
|
|
|
}
|
2016-05-16 22:24:56 +00:00
|
|
|
exports.activeOra = this;
|
2016-05-19 17:27:09 +00:00
|
|
|
exports.oraActive = true;
|
2016-05-14 14:26:38 +00:00
|
|
|
this._oraObject.start();
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
end() {
|
2016-05-13 23:18:44 +00:00
|
|
|
this._oraObject.stop();
|
|
|
|
this._oraObject.clear();
|
2016-05-16 22:24:56 +00:00
|
|
|
exports.activeOra = undefined;
|
2016-05-19 17:27:09 +00:00
|
|
|
exports.oraActive = false;
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
endOk(textArg) {
|
2016-05-13 23:18:44 +00:00
|
|
|
this.end();
|
2016-10-16 00:26:43 +00:00
|
|
|
beautylog_log_helpers_1.logNode('ok', textArg);
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
endError(textArg) {
|
2016-05-13 23:18:44 +00:00
|
|
|
this.end();
|
2016-10-16 00:26:43 +00:00
|
|
|
beautylog_log_helpers_1.logNode('error', textArg);
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
pause() {
|
2016-05-19 17:27:09 +00:00
|
|
|
this._oraObject.stop();
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
stop() {
|
2018-03-01 00:06:12 +00:00
|
|
|
// alias for end
|
2016-05-14 14:26:38 +00:00
|
|
|
this.end();
|
2016-07-23 17:47:23 +00:00
|
|
|
}
|
|
|
|
}
|
2016-05-13 23:18:44 +00:00
|
|
|
exports.Ora = Ora;
|
2017-01-21 22:12:39 +00:00
|
|
|
exports.ora = new Ora('init...', 'blue', false);
|
2018-03-01 00:06:12 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMub3JhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5bG9nLmNsYXNzZXMub3JhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMEJBQXdCO0FBQ3hCLCtDQUErQztBQUMvQyxtRUFBa0Q7QUFFdkMsUUFBQSxTQUFTLEdBQVksS0FBSyxDQUFDLENBQUMsb0RBQW9EO0FBRzNGO0lBR0UsWUFBWSxPQUFlLEVBQUUsUUFBZ0Is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