import { ref, watch } from "vue";
export default function (getValue) {
  let cacheRef = ref();
  watch(() => getValue(), val => {
    if (val === cacheRef.value) return;
    cacheRef.value = val;
  }, {
    immediate: true
  });
  return cacheRef;
}