summaryrefslogtreecommitdiff
path: root/src/client/app
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-05-21 04:26:14 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-05-21 04:26:14 +0900
commita434cfbe0d1dc0762597b15d78fc034ede1039fb (patch)
treee2077d5c07436f65b15340c2b780735ea498b6cf /src/client/app
parentReduce initial bundle size (diff)
downloadsharkey-a434cfbe0d1dc0762597b15d78fc034ede1039fb.tar.gz
sharkey-a434cfbe0d1dc0762597b15d78fc034ede1039fb.tar.bz2
sharkey-a434cfbe0d1dc0762597b15d78fc034ede1039fb.zip
Fix
Diffstat (limited to 'src/client/app')
-rw-r--r--src/client/app/desktop/script.ts2
-rw-r--r--src/client/app/init.ts35
-rw-r--r--src/client/app/mobile/script.ts2
3 files changed, 19 insertions, 20 deletions
diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts
index 10b929ff3f..845f8ee5c0 100644
--- a/src/client/app/desktop/script.ts
+++ b/src/client/app/desktop/script.ts
@@ -60,7 +60,7 @@ init(async (launch, os) => {
});
if (o.cb) vm.$once('closed', o.cb);
} else {
- this.$root.new(() => import('./views/components/post-form-window.vue').then(m => m.default), {
+ this.$root.newAsync(() => import('./views/components/post-form-window.vue').then(m => m.default), {
reply: o.reply,
mention: o.mention,
animation: o.animation == null ? true : o.animation
diff --git a/src/client/app/init.ts b/src/client/app/init.ts
index 6d95f61e65..da7baff4fe 100644
--- a/src/client/app/init.ts
+++ b/src/client/app/init.ts
@@ -449,25 +449,24 @@ export default (callback: (launch: (router: VueRouter) => [Vue, MiOS], os: MiOS)
getMetaSync: os.getMetaSync,
signout: os.signout,
new(vm, props) {
- if (typeof vm === 'function') {
- return new Promise((res) => {
- vm().then(vm => {
- const x = new vm({
- parent: this,
- propsData: props
- }).$mount();
- document.body.appendChild(x.$el);
- res(x);
- });
+ const x = new vm({
+ parent: this,
+ propsData: props
+ }).$mount();
+ document.body.appendChild(x.$el);
+ return x;
+ },
+ newAsync(vm, props) {
+ return new Promise((res) => {
+ vm().then(vm => {
+ const x = new vm({
+ parent: this,
+ propsData: props
+ }).$mount();
+ document.body.appendChild(x.$el);
+ res(x);
});
- } else {
- const x = new vm({
- parent: this,
- propsData: props
- }).$mount();
- document.body.appendChild(x.$el);
- return x;
- }
+ });
},
dialog(opts) {
const vm = this.new(Dialog, opts);
diff --git a/src/client/app/mobile/script.ts b/src/client/app/mobile/script.ts
index 24453bd26c..d33bafbb0f 100644
--- a/src/client/app/mobile/script.ts
+++ b/src/client/app/mobile/script.ts
@@ -50,7 +50,7 @@ init((launch, os) => {
document.documentElement.style.overflow = 'auto';
}
- this.$root.new(() => import('./views/components/post-form-dialog.vue').then(m => m.default), {
+ this.$root.newAsync(() => import('./views/components/post-form-dialog.vue').then(m => m.default), {
reply: o.reply,
mention: o.mention,
renote: o.renote