mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-20 15:23:50 +02:00
use vueuse
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useEventListener } from '@vueuse/core';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toast } from 'vue-sonner';
|
||||
|
||||
@@ -243,22 +244,11 @@ export function useToolNavPinning() {
|
||||
dispatchNavLayoutUpdated();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
window.addEventListener(NAV_LAYOUT_UPDATED_EVENT, refreshPinnedState);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
window.removeEventListener(
|
||||
NAV_LAYOUT_UPDATED_EVENT,
|
||||
refreshPinnedState
|
||||
);
|
||||
});
|
||||
useEventListener(
|
||||
typeof window !== 'undefined' ? window : undefined,
|
||||
NAV_LAYOUT_UPDATED_EVENT,
|
||||
refreshPinnedState
|
||||
);
|
||||
|
||||
return {
|
||||
pinnedToolKeys: computed(() => pinnedToolKeysRef.value),
|
||||
|
||||
Reference in New Issue
Block a user