diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-02-22 23:53:07 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-02-22 23:53:07 +0900 |
| commit | b5068aae059c50ef837d2a5a20ae6c85d8ee7f98 (patch) | |
| tree | e4fb3849a62453c479900a76418c5eb3bc7e880d /src/web/app/init.ts | |
| parent | wip (diff) | |
| download | sharkey-b5068aae059c50ef837d2a5a20ae6c85d8ee7f98.tar.gz sharkey-b5068aae059c50ef837d2a5a20ae6c85d8ee7f98.tar.bz2 sharkey-b5068aae059c50ef837d2a5a20ae6c85d8ee7f98.zip | |
wip
Diffstat (limited to 'src/web/app/init.ts')
| -rw-r--r-- | src/web/app/init.ts | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/web/app/init.ts b/src/web/app/init.ts index e4cb8f8bc0..ac567c5023 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -87,8 +87,26 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v // アプリ基底要素マウント document.body.innerHTML = '<div id="app"></div>'; + const app = new Vue({ + router: new VueRouter({ + mode: 'history' + }), + created() { + this.$watch('os.i', i => { + // キャッシュ更新 + localStorage.setItem('me', JSON.stringify(i)); + }, { + deep: true + }); + }, + render: createEl => createEl(App) + }); + + os.app = app; + const launch = (api: (os: MiOS) => API) => { os.apis = api(os); + Vue.mixin({ data() { return { @@ -99,20 +117,8 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v } }); - const app = new Vue({ - router: new VueRouter({ - mode: 'history' - }), - created() { - this.$watch('os.i', i => { - // キャッシュ更新 - localStorage.setItem('me', JSON.stringify(i)); - }, { - deep: true - }); - }, - render: createEl => createEl(App) - }).$mount('#app'); + // マウント + app.$mount('#app'); return [app, os] as [Vue, MiOS]; }; |