smartlog-destination-local/dist/beautylog.classes.ora.js

55 lines
5.1 KiB
JavaScript
Raw Normal View History

2016-05-13 23:18:44 +00:00
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./beautylog.plugins");
var log = require("./beautylog.log");
var Ora = (function () {
function Ora(textArg, colorArg, startArg) {
if (startArg === void 0) { startArg = false; }
2016-05-13 23:18:44 +00:00
this._oraObject = plugins.ora({
spinner: "dots",
text: textArg,
color: colorArg
});
startArg ? this._oraObject.start() : void (0);
2016-05-13 23:18:44 +00:00
}
Ora.prototype.text = function (textArg) {
this._oraObject.text = textArg;
};
;
2016-05-14 15:51:35 +00:00
Ora.prototype.start = function (textArg, colorArg) {
if (textArg)
this._oraObject.text = textArg;
if (colorArg)
this._oraObject.color = colorArg;
this._oraObject.start();
};
;
2016-05-13 23:18:44 +00:00
Ora.prototype.end = function () {
this._oraObject.stop();
this._oraObject.clear();
};
Ora.prototype.endOk = function (textArg) {
this.end();
log.ok(textArg);
};
;
Ora.prototype.endError = function (textArg) {
this.end();
log.error(textArg);
};
;
Ora.prototype.stop = function () {
this.end();
};
// log methods that play nice with ora
Ora.prototype.log = function (logText, logType) {
this.stop();
log.log(logText, logType);
this.start();
};
2016-05-13 23:18:44 +00:00
return Ora;
}());
exports.Ora = Ora;
2016-05-14 15:51:35 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLm9yYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFDL0MsSUFBWSxHQUFHLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV2QztJQUdJLGFBQVksT0FBYyxFQUFDLFFBQWUsRUFBQyxRQUF3QjtRQUF4Qix3QkFBd0IsR0FBeEIsZ0JBQXdCO1FBQy9ELElBQUksQ0FB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