Add Progress dialog
parent
8bb828191d
commit
2bc172043a
@ -0,0 +1,26 @@
|
||||
import Dialog, { DialogOptions } from "./dialog";
|
||||
|
||||
type ProgressOptions = Partial<{ text: string; pulsate: true; noCancel: true }>;
|
||||
|
||||
export default class Progress {
|
||||
private dialog: Dialog;
|
||||
|
||||
async show(options: ProgressOptions): Promise<void> {
|
||||
this.dialog = new Dialog("progress", Progress.prepareOptions(options));
|
||||
await this.dialog.show();
|
||||
}
|
||||
|
||||
static prepareOptions(options: ProgressOptions): DialogOptions {
|
||||
const ret: DialogOptions = {};
|
||||
if (typeof options.text === "string") {
|
||||
ret.text = options.text;
|
||||
}
|
||||
ret.pulsate = options.pulsate;
|
||||
ret["no-cancel"] = options.noCancel;
|
||||
return ret;
|
||||
}
|
||||
|
||||
async hide() {
|
||||
return this.dialog.hide();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue