Skip to content

Commit

Permalink
Convert more components to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
steinbro committed Nov 22, 2024
1 parent d405c7b commit 9b3a84e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/components/MainModeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
</button>
</template>

<script setup>
import mode_exit_wav from "/assets/sounds/mode_exit.wav";
import mode_enter_wav from "/assets/sounds/mode_enter.wav";
<script setup lang="ts">
import { ref } from 'vue';
import { audioQueue } from '../state/audio';
import useAnnouncer from '../composables/announcer';
import { myLocation } from '../state/location';
const mode_exit_wav = new URL("/assets/sounds/mode_exit.wav", import.meta.url).href;
const mode_enter_wav = new URL("/assets/sounds/mode_enter.wav", import.meta.url).href;
const announcer = useAnnouncer();
const activeMode = ref(null);
var wakeLock = null;
const activeMode = ref<string>();
var wakeLock: WakeLockSentinel | null;
// When mode button is clicked:
// If a mode is currently active, end that mode
// If mode button was different from current mode, start new mode
async function toggleMode(newMode) {
async function toggleMode(newMode: string) {
// Clear queued audio
if (activeMode.value) {
audioQueue.stopAndClear();
Expand All @@ -48,7 +48,7 @@ async function toggleMode(newMode) {
// Stop here if the intent was to end the current mode
if (activeMode.value == newMode) {
// exit current mode
activeMode.value = null;
activeMode.value = undefined;
if (wakeLock) {
// Release the Wake Lock
Expand Down Expand Up @@ -90,10 +90,10 @@ async function toggleMode(newMode) {
case "near_me":
announcer.calloutNearestRoad(
myLocation.latitude, myLocation.longitude
myLocation.latitude!, myLocation.longitude!
);
announcer.calloutAllFeaturesOrSayNoneFound(
myLocation.latitude, myLocation.longitude
myLocation.latitude!, myLocation.longitude!
);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/HelpView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</div>
</template>

<script setup>
<script setup lang="ts">
import InputSpinner from '../components/InputSpinner.vue';
import SubpageTopbar from '../components/SubpageTopbar.vue';
</script>
Expand Down

0 comments on commit 9b3a84e

Please sign in to comment.