@fefade/vue
Version:
Reusable Vue UI components powered by the FEFADE core system.
20 lines (19 loc) • 545 B
JavaScript
import { ref as a, onMounted as i, onBeforeUnmount as r, watch as v } from "vue";
function d(n, u, l) {
const f = a(null), o = l ?? f, e = a(void 0);
return i(() => {
const t = o.value;
!t || typeof n != "function" || (e.value = n(t, u));
}), r(() => {
e.value && typeof e.value.destroy == "function" && e.value.destroy(), e.value = void 0;
}), v(
() => u,
(t) => {
e.value && typeof e.value.update == "function" && e.value.update(t);
},
{ deep: !0, immediate: !0 }
), o;
}
export {
d as default
};