Skip to content

Commit

Permalink
refactor: minor syntax improvements
Browse files Browse the repository at this point in the history
* Update defineEmits to Vue 3.3 "labeled tuple elements" syntax
* Fix minor type error
* Simplify nested ternary operation
  • Loading branch information
ferferga committed Aug 16, 2023
1 parent 3990010 commit 2cd4542
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Dialogs/GenericDialog.vue
Expand Up @@ -54,7 +54,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(e: 'close'): void;
close: [];
}>();
const slots = useSlots();
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/Item/ItemMenu.vue
Expand Up @@ -324,13 +324,12 @@ const copyDownloadURLAction = {
/**
* The Map is mapped to an string like: EpisodeName: DownloadUrl
*/
const text = streamUrls
? typeof streamUrls === 'string'
? streamUrls
: [...streamUrls.entries()]
const text =
streamUrls instanceof Map
? [...streamUrls.entries()]
.map(([k, v]) => `(${k}) - ${v}`)
.join('\n')
: undefined;
: streamUrls;
const copyAction = async (txt: string): Promise<void> => {
await clipboard.copy(txt);
Expand Down
Expand Up @@ -145,7 +145,7 @@ import { getLocaleName } from '@/utils/i18n';
const props = defineProps<{ item: BaseItemDto; mediaSourceIndex?: number }>();
const emit = defineEmits<{
(e: 'close'): void;
close: [];
}>();
const { t, locale } = useI18n();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Item/MediaSourceSelector.vue
Expand Up @@ -27,7 +27,7 @@ const selectProps = defineProps<{
}>();
const emits = defineEmits<{
(e: 'input', newIndex: number): void;
input: [newIndex: number];
}>();
const currentSource = ref(
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/Playback/MusicVisualizer.vue
Expand Up @@ -33,7 +33,6 @@ onBeforeUnmount(() => {
if (visualizerInstance) {
visualizerInstance.disconnectInput();
visualizerInstance.disconnectOutput();
visualizerInstance = undefined;
}
});
</script>

0 comments on commit 2cd4542

Please sign in to comment.