rudeshark.net/src/client/app/desktop/api/input.ts

21 lines
455 B
TypeScript
Raw Normal View History

2018-02-18 04:35:18 +01:00
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,
2018-02-18 14:14:51 +01:00
type: o.type || 'text',
allowEmpty: o.allowEmpty
2018-02-18 04:35:18 +01:00
}
}).$mount();
d.$once('done', text => {
res(text);
});
document.body.appendChild(d.$el);
});
}