mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
17 lines
629 B
TypeScript
17 lines
629 B
TypeScript
import type { App } from 'vue'
|
|
import { getCurrentContext } from 'webext-bridge'
|
|
|
|
export function setupApp(app: App) {
|
|
const context = getCurrentContext()
|
|
|
|
// Inject a globally available `$app` object in template
|
|
app.config.globalProperties.$app = { context }
|
|
|
|
// Provide access to `app` in script setup with `const app = inject('app')`
|
|
app.provide('app', app.config.globalProperties.$app)
|
|
|
|
// Here you can install additional plugins for all contexts: popup, options page and content-script.
|
|
// example: app.use(i18n)
|
|
// example excluding content-script context: if (context !== 'content-script') app.use(i18n)
|
|
}
|