-import {onSelect} from "../services/dom";
+import {onSelect} from '../services/dom.ts';
+import {Component} from './component';
/**
* Custom equivalent of window.confirm() using our popup component.
* Is promise based so can be used like so:
* `const result = await dialog.show()`
- * @extends {Component}
*/
-class ConfirmDialog {
+export class ConfirmDialog extends Component {
setup() {
this.container = this.$el;
this.sendResult(false);
});
- return new Promise((res, rej) => {
- this.res = res;
+ return new Promise(res => {
+ this.res = res;
});
}
* @returns {Popup}
*/
getPopup() {
- return this.container.components.popup;
+ return window.$components.firstOnElement(this.container, 'popup');
}
/**
*/
sendResult(result) {
if (this.res) {
- this.res(result)
+ this.res(result);
this.res = null;
}
}
}
-
-export default ConfirmDialog;
\ No newline at end of file