yumechi-no-kuni/src/client/app/desktop/api/dialog.ts

19 lines
391 B
TypeScript
Raw Normal View History

2018-05-27 04:12:39 -05:00
import OS from '../../mios';
2018-02-17 21:35:18 -06:00
import Dialog from '../views/components/dialog.vue';
2018-05-27 04:12:39 -05:00
export default (os: OS) => opts => {
2018-02-17 21:35:18 -06:00
return new Promise<string>((res, rej) => {
const o = opts || {};
2018-05-27 04:12:39 -05:00
const d = os.new(Dialog, {
title: o.title,
text: o.text,
modal: o.modal,
buttons: o.actions
});
2018-02-17 21:35:18 -06:00
d.$once('clicked', id => {
res(id);
});
document.body.appendChild(d.$el);
});
2018-05-27 11:09:59 -05:00
};