/* * Copyright (c) 2022. * Author Peter Placzek (tada5hi) * For the full copyright and license information, * view the LICENSE file that was distributed with this source code. */ import {Context} from "@nuxt/types"; import {Inject} from "@nuxt/types/app"; import {ChatModule} from "~/modules/chat"; declare module 'vue/types/vue' { // this.$myInjectedFunction inside Vue components interface Vue { $chat: ChatModule } } declare module '@nuxt/types' { // nuxtContext.app.$myInjectedFunction inside asyncData, fetch, plugins, middleware, nuxtServerInit interface NuxtAppOptions { $chat: ChatModule } // nuxtContext.$myInjectedFunction interface Context { $chat: ChatModule } } declare module 'vuex/types/index' { // this.$myInjectedFunction inside Vuex stores interface Store { $chat: ChatModule } } export default (ctx : Context, inject : Inject) => { const chatModule = new ChatModule(ctx); inject('chat', chatModule); };