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

export default function(opts) {
	return new Promise<string>((res, rej) => {
		const o = opts || {};
		const d = new InputDialog({
			propsData: {
				title: o.title,
				placeholder: o.placeholder,
				default: o.default,
				type: o.type || 'text',
				allowEmpty: o.allowEmpty
			}
		}).$mount();
		d.$once('done', text => {
			res(text);
		});
		document.body.appendChild(d.$el);
	});
}