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

51 lines
4.5 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;
};
;
Ora.prototype.start = function () {
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;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLm9yYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFDL0MsSUFBWSxHQUFHLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV2QztJQUdJLGFBQVksT0FBYyxFQUFDLFFBQWUsRUFBQyxRQUF3QjtRQUF4Qix3QkFBd0IsR0FBeEIsZ0JBQXdCO1FBQy9ELElBQUksQ0FBQyxVQUFVLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQztZQUMxQixPQUFPLEVBQUMsTUFBTTtZQUNkLElBQUksRUFBQyxP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