summaryrefslogtreecommitdiff
path: root/src/web/app/desktop/api/dialog.ts
blob: 07935485b00cfe577dd0a4f02a75addbeae64190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Dialog from '../views/components/dialog.vue';

export default function(opts) {
	return new Promise<string>((res, rej) => {
		const o = opts || {};
		const d = new Dialog({
			propsData: {
				title: o.title,
				text: o.text,
				modal: o.modal,
				buttons: o.actions
			}
		}).$mount();
		d.$once('clicked', id => {
			res(id);
		});
		document.body.appendChild(d.$el);
	});
}