import Vue from 'vue' ; import { Store } from 'vuex' ; export default abstract class Service { protected app : Vue ; public readonly ready : Promise < void > ; constructor ( app , ... args ) { this . app = app ; this . ready = Promise . resolve ( ) . then ( ( ) => this . init ( ... args ) ) ; } public async destroy ( ) { this . unregisterStoreModule ( this . app . $store ) ; } protected async init ( ... args ) { this . registerStoreModule ( this . app . $store ) ; } protected registerStoreModule ( store ) { } protected unregisterStoreModule ( store ) { } }