diff --git a/src/components/LogOutput/LogOutput.vue b/src/components/LogOutput/LogOutput.vue
index 34c1a81..b3d346d 100644
--- a/src/components/LogOutput/LogOutput.vue
+++ b/src/components/LogOutput/LogOutput.vue
@@ -29,12 +29,15 @@
diff --git a/src/composables/useForceRerender/useForceRerender.test.ts b/src/composables/useForceRerender/useForceRerender.test.ts
index 989682e..a7450bc 100644
--- a/src/composables/useForceRerender/useForceRerender.test.ts
+++ b/src/composables/useForceRerender/useForceRerender.test.ts
@@ -1,12 +1,11 @@
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
-import {
- useForceRerender,
- isRerendering,
-} from '@/composables/useForceRerender/useForceRerender';
+import useForceRerender from '@/composables/useForceRerender/useForceRerender';
describe('useForceRerender Composable', () => {
it('should trigger a rerender when called', async () => {
+ const { isRerendering, forceRerender } = useForceRerender();
+
const text = 'Component to rerender';
const wrapper = mount({
@@ -23,7 +22,7 @@ describe('useForceRerender Composable', () => {
});
// Call the useForceRerender composable
- await useForceRerender();
+ await forceRerender();
// Check that the component has rerendered
expect(wrapper.text()).toBe(text);
diff --git a/src/composables/useForceRerender/useForceRerender.ts b/src/composables/useForceRerender/useForceRerender.ts
index 7ede455..4de4fe3 100644
--- a/src/composables/useForceRerender/useForceRerender.ts
+++ b/src/composables/useForceRerender/useForceRerender.ts
@@ -3,20 +3,27 @@ import { nextTick, ref } from 'vue';
/**
* Reactive boolean that can be used to force a component to rerender.
*/
-export const isRerendering = ref(true);
+const isRerendering = ref(true);
/**
* Tries to rerender the component by removing it from the DOM and adding it back in.
*
- * Only works if the compnent has a v-if="rerender" directive. active
+ * Only works if the component has a v-if="rerender" directive.
*/
-export const useForceRerender = async () => {
- // Remove component from the DOM
- isRerendering.value = false;
+export default function useForceRerender() {
+ const forceRerender = async () => {
+ // Remove component from the DOM
+ isRerendering.value = false;
- // Wait for the change to get flushed to the DOM
- await nextTick();
+ // Wait for the change to get flushed to the DOM
+ await nextTick();
- // Add the component back in
- isRerendering.value = true;
-};
+ // Add the component back in
+ isRerendering.value = true;
+ };
+
+ return {
+ forceRerender,
+ isRerendering,
+ };
+}
diff --git a/src/composables/useRunning/useRunning.ts b/src/composables/useRunning/useRunning.ts
index c14baf8..6cfd344 100644
--- a/src/composables/useRunning/useRunning.ts
+++ b/src/composables/useRunning/useRunning.ts
@@ -5,30 +5,36 @@ import useNotificationSystem from '@/composables/useNotificationSystem/useNotifi
/**
* Reactive boolean that can be used to check the capture status.
*/
-export const isRunning = ref(false);
+const isRunning = ref(false);
/**
* Function that can be used to start and stop the capturing.
*/
-export const useRunning = () => {
+export default function useRunning() {
const vigad = Vigad.getInstance();
- const start = () => {
+ /**
+ * Start capturing.
+ */
+ const start = (): void => {
isRunning.value = true;
vigad.startTesseract();
useNotificationSystem().createNotification({
title: 'Started Capturing',
- message: 'Capturing is now running'
+ message: 'Capturing is now running',
});
};
- const stop = () => {
+ /**
+ * Stop capturing.
+ */
+ const stop = (): void => {
isRunning.value = false;
vigad.stopTesseract();
useNotificationSystem().createWarningNotification({
title: 'Stopped Capturing',
- message: 'Capturing was stopped'
- })
+ message: 'Capturing was stopped',
+ });
};
return {
@@ -36,4 +42,4 @@ export const useRunning = () => {
start,
stop,
};
-};
+}
diff --git a/src/views/CapturePage.vue b/src/views/CapturePage.vue
index 18bc024..1ec62b8 100644
--- a/src/views/CapturePage.vue
+++ b/src/views/CapturePage.vue
@@ -7,7 +7,7 @@
prepend-icon="mdi-play"
variant="tonal"
:disabled="captureAreas.length === 0"
- @click="useRunning().start()"
+ @click="start()"
>Start
Stop
@@ -41,11 +41,13 @@