misskey/src/client/app/mobile/api/dialog.ts

19 lines
391 B
TypeScript
Raw Normal View History

2018-06-20 18:58:47 +02:00
import OS from '../../mios';
import Dialog from '../views/components/dialog.vue';
export default (os: OS) => opts => {
2018-02-21 18:00:30 +01:00
return new Promise<string>((res, rej) => {
2018-06-20 18:58:47 +02:00
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);
2018-02-21 18:00:30 +01:00
});
2018-06-20 18:58:47 +02:00
};