You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
806 B
JavaScript

class ConfirmWidget extends Widget {
constructor(data, renderer) {
super(data, renderer);
this.update(data);
}
update(data) {
super.update(data);
if ('action' in data) asyncConfirm(this.data.text).then(res => this.set(res ? 1 : 0));
}
}
Renderer.register('confirm', ConfirmWidget, true);
class PromptWidget extends Widget {
constructor(data, renderer) {
super(data, renderer);
this.update(data);
}
update(data) {
super.update(data);
if ('action' in data) asyncPrompt(this.data.text, this.data.value).then(res => {
if (res !== null){
this.data.value = res;
this.set(res);
}
});
}
}
Renderer.register('prompt', PromptWidget, true);