1 import {onSelect} from '../services/dom.ts';
2 import {Component} from './component';
5 * Custom equivalent of window.confirm() using our popup component.
6 * Is promise based so can be used like so:
7 * `const result = await dialog.show()`
9 export class ConfirmDialog extends Component {
12 this.container = this.$el;
13 this.confirmButton = this.$refs.confirm;
17 onSelect(this.confirmButton, () => {
18 this.sendResult(true);
19 this.getPopup().hide();
24 this.getPopup().show(null, () => {
25 this.sendResult(false);
28 return new Promise(res => {
37 return window.$components.firstOnElement(this.container, 'popup');
41 * @param {Boolean} result