diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-02-21 02:53:34 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-02-21 02:53:34 +0900 |
| commit | a1e57841e71e442b1bf52e445e6c541f16ec066d (patch) | |
| tree | 2b6862b8b47a68a98d0c1534d5dbe1ca356bea2d /src/web/app/init.ts | |
| parent | wip (diff) | |
| download | sharkey-a1e57841e71e442b1bf52e445e6c541f16ec066d.tar.gz sharkey-a1e57841e71e442b1bf52e445e6c541f16ec066d.tar.bz2 sharkey-a1e57841e71e442b1bf52e445e6c541f16ec066d.zip | |
wip
Diffstat (limited to 'src/web/app/init.ts')
| -rw-r--r-- | src/web/app/init.ts | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 9e49c4f0fb..b814a18066 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -34,7 +34,7 @@ Vue.mixin({ import App from './app.vue'; import checkForUpdate from './common/scripts/check-for-update'; -import MiOS from './common/mios'; +import MiOS, { API } from './common/mios'; /** * APP ENTRY POINT! @@ -79,59 +79,32 @@ if (localStorage.getItem('should-refresh') == 'true') { location.reload(true); } -type API = { - chooseDriveFile: (opts: { - title?: string; - currentFolder?: any; - multiple?: boolean; - }) => Promise<any>; - - chooseDriveFolder: (opts: { - title?: string; - currentFolder?: any; - }) => Promise<any>; - - dialog: (opts: { - title: string; - text: string; - actions: Array<{ - text: string; - id: string; - }>; - }) => Promise<string>; - - input: (opts: { - title: string; - placeholder?: string; - default?: string; - }) => Promise<string>; - - post: () => void; -}; - // MiOSを初期化してコールバックする -export default (callback: (launch: (api: API) => Vue) => void, sw = false) => { +export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => void, sw = false) => { const os = new MiOS(sw); os.init(() => { // アプリ基底要素マウント document.body.innerHTML = '<div id="app"></div>'; - const launch = (api: API) => { + const launch = (api: (os: MiOS) => API) => { + os.apis = api(os); Vue.mixin({ created() { (this as any).os = os; (this as any).api = os.api; - (this as any).apis = api; + (this as any).apis = os.apis; } }); - return new Vue({ + const app = new Vue({ router: new VueRouter({ mode: 'history' }), render: createEl => createEl(App) }).$mount('#app'); + + return [app, os] as [Vue, MiOS]; }; try { |