I have custom service instances created in main.ts
app.config.globalProperties.$service1 = new Service1();
app.config.globalProperties.$service2 = new Service2();
I can use these instances inside vue components but I want to be able to use them in some utility files.
In vue 2 it was like:
import Vue from "vue";
Vue.prototype.$service1.someMethod("foo");
The only option that worked for me is to export the app
instance in main.ts
and importing it in my utility files but that did not look right.
What is the equivalent of Vue.prototype
in Vue 3?
How to keep it singleton and still use the instances outside vue components?