-
Notifications
You must be signed in to change notification settings - Fork 334
/
app.ts
49 lines (43 loc) · 1.1 KB
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { ThemeManager } from './theme'
import { LanguageManager } from './lang'
export interface IApp {
name: string
author: {
name: string
link: string
}
}
export function AppSetup() {
// declare app information
const app: IApp = {
name: 'Nuxt 3 Awesome Starter',
author: {
name: 'viandwi24',
link: 'https://github.com/viandwi24',
},
}
useState('app', () => app)
// use theme manager
const themeManager = ThemeManager()
// use language manager
const languageManager = LanguageManager()
// vue transition bug handle
const messages = [
`Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`, // chromium based
`NotFoundError: The object can not be found here.`, // safari
]
if (typeof window !== 'undefined') {
window.addEventListener('error', (ev) => {
if (messages.includes(ev.message)) {
ev.preventDefault()
window.location.reload()
}
})
}
// return
return {
app,
themeManager,
languageManager,
}
}