From 99b34993640eb91a591faa4bccf7d7b6f176ad97 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 18 Feb 2018 12:35:18 +0900 Subject: wip --- src/web/app/init.ts | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'src/web/app/init.ts') diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 450327a588..8abb7f7aa5 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -78,37 +78,50 @@ if (localStorage.getItem('should-refresh') == 'true') { type API = { chooseDriveFile: (opts: { - title: string; - currentFolder: any; - multiple: boolean; + title?: string; + currentFolder?: any; + multiple?: boolean; }) => Promise; chooseDriveFolder: (opts: { - title: string; - currentFolder: any; + title?: string; + currentFolder?: any; }) => Promise; + + dialog: (opts: { + title: string; + text: string; + actions: Array<{ + text: string; + id: string; + }>; + }) => Promise; + + input: (opts: { + title: string; + placeholder?: string; + default?: string; + }) => Promise; }; // MiOSを初期化してコールバックする export default (callback: (launch: (api: API) => Vue) => void, sw = false) => { - const mios = new MiOS(sw); + const os = new MiOS(sw); - Vue.mixin({ - data: { - $os: mios - } - }); - - mios.init(() => { + os.init(() => { // アプリ基底要素マウント document.body.innerHTML = '
'; const launch = (api: API) => { + Vue.mixin({ + created() { + (this as any).os = os; + (this as any).api = os.api; + (this as any).apis = api; + } + }); + return new Vue({ - data: { - os: mios, - api: api - }, router: new VueRouter({ mode: 'history' }), @@ -124,7 +137,7 @@ export default (callback: (launch: (api: API) => Vue) => void, sw = false) => { // 更新チェック setTimeout(() => { - checkForUpdate(mios); + checkForUpdate(os); }, 3000); }); }; -- cgit v1.2.3-freya