2018-07-04 20:50:46 +00:00
|
|
|
import * as plugins from './sl.destlocal.plugins';
|
|
|
|
import { Beautylog } from './sl.destlocal.classes.beautylog';
|
2016-05-13 23:18:44 +00:00
|
|
|
|
|
|
|
export class Ora {
|
2018-03-03 12:57:55 +00:00
|
|
|
beautylog: Beautylog;
|
2018-03-01 00:06:12 +00:00
|
|
|
state: string;
|
|
|
|
private _oraObject;
|
2018-03-03 12:57:55 +00:00
|
|
|
constructor(beautylogInstanceArg: Beautylog = new Beautylog()) {
|
2017-03-11 11:30:18 +00:00
|
|
|
this._oraObject = plugins.ora({
|
|
|
|
spinner: 'dots',
|
2018-03-03 12:57:55 +00:00
|
|
|
text: '',
|
|
|
|
color: 'blue'
|
2018-03-01 00:06:12 +00:00
|
|
|
});
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
|
|
|
text(textArg) {
|
2018-03-01 00:06:12 +00:00
|
|
|
this._oraObject.text = textArg;
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
2016-10-16 00:26:43 +00:00
|
|
|
|
2017-03-11 11:30:18 +00:00
|
|
|
start(textArg?: string, colorArg?: string) {
|
2018-03-01 00:06:12 +00:00
|
|
|
if (textArg) {
|
|
|
|
this.text(textArg);
|
|
|
|
}
|
|
|
|
if (colorArg) {
|
|
|
|
this._oraObject.color = colorArg;
|
|
|
|
}
|
|
|
|
this._oraObject.start();
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
|
|
|
end() {
|
2018-03-01 00:06:12 +00:00
|
|
|
this._oraObject.stop();
|
|
|
|
this._oraObject.clear();
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
|
|
|
endOk(textArg) {
|
2018-03-01 00:06:12 +00:00
|
|
|
this.end();
|
|
|
|
logNode('ok', textArg);
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
|
|
|
endError(textArg) {
|
2018-03-01 00:06:12 +00:00
|
|
|
this.end();
|
|
|
|
logNode('error', textArg);
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
|
|
|
pause() {
|
2018-03-01 00:06:12 +00:00
|
|
|
this._oraObject.stop();
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
2018-03-01 00:06:12 +00:00
|
|
|
stop() {
|
|
|
|
// alias for end
|
|
|
|
this.end();
|
2017-03-11 11:30:18 +00:00
|
|
|
}
|
2016-10-16 00:26:43 +00:00
|
|
|
}
|