summaryrefslogtreecommitdiff
path: root/src/client/app/init.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-11-09 16:00:29 +0900
committerGitHub <noreply@github.com>2018-11-09 16:00:29 +0900
commit3f79c9ae4927d4186c708e130ecbb1ea4f72d9fa (patch)
tree3af53c7b8d5ecc5f0c21cbc5abec3ec5254606b0 /src/client/app/init.ts
parent[Client] Fix bug (diff)
downloadsharkey-3f79c9ae4927d4186c708e130ecbb1ea4f72d9fa.tar.gz
sharkey-3f79c9ae4927d4186c708e130ecbb1ea4f72d9fa.tar.bz2
sharkey-3f79c9ae4927d4186c708e130ecbb1ea4f72d9fa.zip
Refactor client (#3178)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
Diffstat (limited to 'src/client/app/init.ts')
-rw-r--r--src/client/app/init.ts36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/client/app/init.ts b/src/client/app/init.ts
index 10745aadea..d5833019db 100644
--- a/src/client/app/init.ts
+++ b/src/client/app/init.ts
@@ -13,7 +13,7 @@ import VueI18n from 'vue-i18n';
import VueHotkey from './common/hotkey';
import App from './app.vue';
import checkForUpdate from './common/scripts/check-for-update';
-import MiOS, { API } from './mios';
+import MiOS from './mios';
import { clientVersion as version, codename, lang } from './config';
import { builtinThemes, lightTheme, applyTheme } from './theme';
@@ -180,16 +180,14 @@ if (localStorage.getItem('should-refresh') == 'true') {
}
// MiOSを初期化してコールバックする
-export default (callback: (launch: (router: VueRouter, api?: (os: MiOS) => API) => [Vue, MiOS]) => void, sw = false) => {
+export default (callback: (launch: (router: VueRouter) => [Vue, MiOS]) => void, sw = false) => {
const os = new MiOS(sw);
os.init(() => {
// アプリ基底要素マウント
document.body.innerHTML = '<div id="app"></div>';
- const launch = (router: VueRouter, api?: (os: MiOS) => API) => {
- os.apis = api ? api(os) : null;
-
+ const launch = (router: VueRouter) => {
//#region theme
os.store.watch(s => {
return s.device.darkmode;
@@ -285,7 +283,6 @@ export default (callback: (launch: (router: VueRouter, api?: (os: MiOS) => API)
windows: os.windows
},
stream: os.stream,
- apis: os.apis,
instanceName: os.instanceName
};
},
@@ -293,7 +290,14 @@ export default (callback: (launch: (router: VueRouter, api?: (os: MiOS) => API)
api: os.api,
getMeta: os.getMeta,
getMetaSync: os.getMetaSync,
- new: os.new,
+ new(vm, props) {
+ const x = new vm({
+ parent: this,
+ propsData: props
+ }).$mount();
+ document.body.appendChild(x.$el);
+ return x;
+ },
},
router,
render: createEl => createEl(App)
@@ -304,18 +308,18 @@ export default (callback: (launch: (router: VueRouter, api?: (os: MiOS) => API)
// マウント
app.$mount('#app');
+ //#region 更新チェック
+ const preventUpdate = os.store.state.device.preventUpdate;
+ if (!preventUpdate) {
+ setTimeout(() => {
+ checkForUpdate(app);
+ }, 3000);
+ }
+ //#endregion
+
return [app, os] as [Vue, MiOS];
};
callback(launch);
-
- //#region 更新チェック
- const preventUpdate = os.store.state.device.preventUpdate;
- if (!preventUpdate) {
- setTimeout(() => {
- checkForUpdate(os);
- }, 3000);
- }
- //#endregion
});
};