From 6a8a17c8a42c505a328bb539238e7853e303f0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4ki?= Date: Tue, 8 Oct 2024 17:18:37 +0300 Subject: [PATCH] Add wrapper functions to make it easier for TSMM to inject extra code TSMM can now override the methods locally without having to duplicate the main implementation. --- src/components/mixins/SplashMixin.vue | 7 ++++++- src/components/mixins/UtilityMixin.vue | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/mixins/SplashMixin.vue b/src/components/mixins/SplashMixin.vue index 24e63a9f3..6d7ef24a0 100644 --- a/src/components/mixins/SplashMixin.vue +++ b/src/components/mixins/SplashMixin.vue @@ -49,8 +49,13 @@ export default class SplashMixin extends Vue { this.getRequestItem('ExclusionsList').setProgress(100); } - // Get the list of Thunderstore mods from API or local cache. + // Wrapper to allow TSMM to inject telemetry gathering. async getThunderstoreMods() { + await this._getThunderstoreMods(); + } + + // Get the list of Thunderstore mods from API or local cache. + async _getThunderstoreMods() { const packageListIndex = await this.fetchPackageListIndex(); const packageListChunks = await this.fetchPackageListChunksIfUpdated(packageListIndex); this.getRequestItem('ThunderstoreDownload').setProgress(100); diff --git a/src/components/mixins/UtilityMixin.vue b/src/components/mixins/UtilityMixin.vue index d005d9651..32f2fd657 100644 --- a/src/components/mixins/UtilityMixin.vue +++ b/src/components/mixins/UtilityMixin.vue @@ -15,7 +15,12 @@ export default class UtilityMixin extends Vue { setInterval(this.tryRefreshThunderstoreModList, this.REFRESH_INTERVAL); } + // Wrapper to allow TSMM to inject telemetry gathering. async refreshThunderstoreModList() { + await this._refreshThunderstoreModList(); + } + + async _refreshThunderstoreModList() { const packageListIndex: PackageListIndex = await this.$store.dispatch("tsMods/fetchPackageListIndex"); if (packageListIndex.isLatest) {