Best way for global values for Vue3 to be accessed outside

Hi,

What is the best way to store global values that can be accessed from Vue3 and outside Vue3?

Today, im storing in inside two ways to make it work, but i don’t know what is the correct/best way to do it.

import Module from "../../../nativium/build/wasm/release/wasm/target/bin/nativium";
import EventBus from "../classes/event-bus";
import { useWasmModuleStore } from "../stores/wasm-module";

export default {
    install: (app) => {
        Module().then((wasmModule) => {
            new Promise((r) => setTimeout(r, 300)).then(() => {
                // TODO: What is the best place to store WASM module globally?
                // Because it need by access from non Vue classes (ex: DatabaseItem)
                app.config.globalProperties.$WM = wasmModule;
                window.WM = wasmModule;

                const wm = useWasmModuleStore();
                wm.setLoaded(true);

                EventBus.$emit("wasm-module-loaded");
            });
        });
    },
};

I store inside app and window.

The guy “z1haze” suggest use pinia store to handle it inside and outside Vue.

It works perfect.