summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/api
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-27 18:12:39 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-27 18:12:39 +0900
commitfa1a85f682302c3629326198b3cb5ecf738d3cd7 (patch)
tree3ce7ff0bb761db748374fbcbddf4a2b64ebedca2 /src/client/app/desktop/api
parent2.18.1 (diff)
downloadsharkey-fa1a85f682302c3629326198b3cb5ecf738d3cd7.tar.gz
sharkey-fa1a85f682302c3629326198b3cb5ecf738d3cd7.tar.bz2
sharkey-fa1a85f682302c3629326198b3cb5ecf738d3cd7.zip
Fix bug
Diffstat (limited to 'src/client/app/desktop/api')
-rw-r--r--src/client/app/desktop/api/contextmenu.ts17
-rw-r--r--src/client/app/desktop/api/dialog.ts17
-rw-r--r--src/client/app/desktop/api/input.ts21
-rw-r--r--src/client/app/desktop/api/notify.ts13
-rw-r--r--src/client/app/desktop/api/post.ts21
5 files changed, 41 insertions, 48 deletions
diff --git a/src/client/app/desktop/api/contextmenu.ts b/src/client/app/desktop/api/contextmenu.ts
index b70d7122d3..c92f087551 100644
--- a/src/client/app/desktop/api/contextmenu.ts
+++ b/src/client/app/desktop/api/contextmenu.ts
@@ -1,16 +1,15 @@
+import OS from '../../mios';
import Ctx from '../views/components/context-menu.vue';
-export default function(e, menu, opts?) {
+export default (os: OS) => (e, menu, opts?) => {
const o = opts || {};
- const vm = new Ctx({
- propsData: {
- menu,
- x: e.pageX - window.pageXOffset,
- y: e.pageY - window.pageYOffset,
- }
- }).$mount();
+ const vm = os.new(Ctx, {
+ menu,
+ x: e.pageX - window.pageXOffset,
+ y: e.pageY - window.pageYOffset,
+ });
vm.$once('closed', () => {
if (o.closed) o.closed();
});
document.body.appendChild(vm.$el);
-}
+};
diff --git a/src/client/app/desktop/api/dialog.ts b/src/client/app/desktop/api/dialog.ts
index 07935485b0..32785cf828 100644
--- a/src/client/app/desktop/api/dialog.ts
+++ b/src/client/app/desktop/api/dialog.ts
@@ -1,16 +1,15 @@
+import OS from '../../mios';
import Dialog from '../views/components/dialog.vue';
-export default function(opts) {
+export default (os: OS) => opts => {
return new Promise<string>((res, rej) => {
const o = opts || {};
- const d = new Dialog({
- propsData: {
- title: o.title,
- text: o.text,
- modal: o.modal,
- buttons: o.actions
- }
- }).$mount();
+ const d = os.new(Dialog, {
+ title: o.title,
+ text: o.text,
+ modal: o.modal,
+ buttons: o.actions
+ });
d.$once('clicked', id => {
res(id);
});
diff --git a/src/client/app/desktop/api/input.ts b/src/client/app/desktop/api/input.ts
index ce26a8112f..bd7bfa0129 100644
--- a/src/client/app/desktop/api/input.ts
+++ b/src/client/app/desktop/api/input.ts
@@ -1,20 +1,19 @@
+import OS from '../../mios';
import InputDialog from '../views/components/input-dialog.vue';
-export default function(opts) {
+export default (os: OS) => 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();
+ 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);
});
-}
+};
diff --git a/src/client/app/desktop/api/notify.ts b/src/client/app/desktop/api/notify.ts
index 1f89f40ce6..72e5827607 100644
--- a/src/client/app/desktop/api/notify.ts
+++ b/src/client/app/desktop/api/notify.ts
@@ -1,10 +1,9 @@
+import OS from '../../mios';
import Notification from '../views/components/ui-notification.vue';
-export default function(message) {
- const vm = new Notification({
- propsData: {
- message
- }
- }).$mount();
+export default (os: OS) => message => {
+ const vm = os.new(Notification, {
+ message
+ });
document.body.appendChild(vm.$el);
-}
+};
diff --git a/src/client/app/desktop/api/post.ts b/src/client/app/desktop/api/post.ts
index b569610e1d..af71829c7b 100644
--- a/src/client/app/desktop/api/post.ts
+++ b/src/client/app/desktop/api/post.ts
@@ -1,21 +1,18 @@
+import OS from '../../mios';
import PostFormWindow from '../views/components/post-form-window.vue';
import RenoteFormWindow from '../views/components/renote-form-window.vue';
-export default function(opts) {
+export default (os: OS) => opts => {
const o = opts || {};
if (o.renote) {
- const vm = new RenoteFormWindow({
- propsData: {
- renote: o.renote
- }
- }).$mount();
+ const vm = os.new(RenoteFormWindow, {
+ renote: o.renote
+ });
document.body.appendChild(vm.$el);
} else {
- const vm = new PostFormWindow({
- propsData: {
- reply: o.reply
- }
- }).$mount();
+ const vm = os.new(PostFormWindow, {
+ reply: o.reply
+ });
document.body.appendChild(vm.$el);
}
-}
+};