2023-06-27 15:53:29 +08:00
|
|
|
import { createPinia } from 'pinia'
|
2023-09-22 18:31:50 +08:00
|
|
|
import { createApp, nextTick } from 'vue'
|
2023-06-27 15:53:29 +08:00
|
|
|
import App from './App.vue'
|
2023-08-02 17:13:03 +08:00
|
|
|
import './styles/style.scss'
|
2023-07-18 23:43:31 +08:00
|
|
|
import dayjs from 'dayjs'
|
|
|
|
import duration from 'dayjs/plugin/duration'
|
|
|
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
2023-08-20 15:33:51 +08:00
|
|
|
import { i18n } from '@/utils/i18n.js'
|
2023-08-24 00:44:19 +08:00
|
|
|
import { setupDiscreteApi } from '@/utils/discrete.js'
|
|
|
|
import usePreferencesStore from 'stores/preferences.js'
|
2023-09-02 18:23:40 +08:00
|
|
|
import { loadEnvironment } from '@/utils/platform.js'
|
2023-11-29 01:12:23 +08:00
|
|
|
import { setupMonaco } from '@/utils/monaco.js'
|
2024-01-16 16:13:13 +08:00
|
|
|
import { setupChart } from '@/utils/chart.js'
|
2023-07-18 23:43:31 +08:00
|
|
|
|
|
|
|
dayjs.extend(duration)
|
|
|
|
dayjs.extend(relativeTime)
|
2023-06-27 15:53:29 +08:00
|
|
|
|
2023-08-24 00:44:19 +08:00
|
|
|
async function setupApp() {
|
|
|
|
const app = createApp(App)
|
|
|
|
app.use(i18n)
|
|
|
|
app.use(createPinia())
|
|
|
|
|
2023-09-02 18:23:40 +08:00
|
|
|
await loadEnvironment()
|
2023-11-29 01:12:23 +08:00
|
|
|
setupMonaco()
|
2024-01-16 16:13:13 +08:00
|
|
|
setupChart()
|
2023-08-24 00:44:19 +08:00
|
|
|
const prefStore = usePreferencesStore()
|
|
|
|
await prefStore.loadPreferences()
|
|
|
|
await setupDiscreteApi()
|
2023-08-28 01:02:25 +08:00
|
|
|
app.config.errorHandler = (err, instance, info) => {
|
|
|
|
// TODO: add "send error message to author" later
|
2023-09-22 18:31:50 +08:00
|
|
|
nextTick().then(() => {
|
|
|
|
try {
|
|
|
|
const content = err.toString()
|
|
|
|
$notification.error(content, {
|
|
|
|
title: i18n.global.t('common.error'),
|
|
|
|
meta: 'Please see console output for more detail',
|
|
|
|
})
|
|
|
|
console.error(err)
|
|
|
|
} catch (e) {}
|
|
|
|
})
|
2023-08-28 01:02:25 +08:00
|
|
|
}
|
2023-11-15 23:41:53 +08:00
|
|
|
// app.config.warnHandler = (message) => {
|
|
|
|
// console.warn(message)
|
|
|
|
// }
|
2023-08-24 00:44:19 +08:00
|
|
|
app.mount('#app')
|
|
|
|
}
|
|
|
|
|
|
|
|
setupApp()
|