how can I use framework-independent JavaScript class instances with reactive state on vue-composition-api.
Given following class:
// CounterService / counter-service.ts
//
// this is a normal javascript class which is independent of vue
export const counterService = new (class CounterService {
private count: number = 0;
// should cause all components that use `getCount` to react.
addOne(): void {
this.count++;
}
// should be reactive
getCount(): number {
return this.count;
}
})()
Kind regards
Rozbeh Chiryai Sharahi