smartlog-source-ora/ts/index.ts

41 lines
814 B
TypeScript
Raw Normal View History

2019-05-09 17:17:03 +00:00
import * as plugins from './smartlog-source-ora.plugins';
export class SmartlogSourceOra {
public oraInstance = plugins.ora('loading');
public started = false;
constructor() {}
2019-05-09 17:19:49 +00:00
public text(textArg: string) {
2019-05-09 17:17:03 +00:00
this.oraInstance.text = textArg;
2019-05-09 17:19:49 +00:00
if (!this.started) {
2019-05-09 17:17:03 +00:00
this.started = true;
this.oraInstance.start();
}
}
public stop() {
this.oraInstance.stop();
}
2019-05-09 17:19:49 +00:00
public finishSuccess(textArg?: string) {
2019-05-09 17:17:03 +00:00
this.oraInstance.succeed(textArg);
this.started = false;
}
2019-05-19 14:30:01 +00:00
public finishFail(textArg?: string) {
this.oraInstance.fail(textArg);
2019-05-09 17:17:03 +00:00
this.started = false;
}
public successAndNext(textArg: string) {
this.finishSuccess();
this.text(textArg);
}
public failAndNext(textArg: string) {
this.finishFail();
this.text(textArg);
}
2019-05-09 17:19:49 +00:00
}