summaryrefslogtreecommitdiff
path: root/src/web/app/init.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-22 23:53:07 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-22 23:53:07 +0900
commitb5068aae059c50ef837d2a5a20ae6c85d8ee7f98 (patch)
treee4fb3849a62453c479900a76418c5eb3bc7e880d /src/web/app/init.ts
parentwip (diff)
downloadsharkey-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.ts34
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];
};