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

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