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

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