You've already forked AstralRinth
forked from didirus/AstralRinth
Revert "Rewrite cosmetics and theme preferences (#1292)"
This reverts commit 8704d3acb3.
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Creates a computed reference that uses a provide getter function called with an argument representing the current mount state of the component.
|
||||
* @param getter A getter function that will run with `mounted` argument representing whether or not the component is mounted.
|
||||
* @returns A computed reference that changes when component becomes mounted or unmounted.
|
||||
*/
|
||||
export function useMountedValue<T>(getter: (isMounted: boolean) => T) {
|
||||
const mounted = ref(getCurrentInstance()?.isMounted ?? false);
|
||||
|
||||
onMounted(() => (mounted.value = true));
|
||||
|
||||
onUnmounted(() => (mounted.value = false));
|
||||
|
||||
return computed(() => getter(mounted.value));
|
||||
}
|
||||
Reference in New Issue
Block a user