import { nextTick, Ref, watchEffect, WatchEffect } from "vue"; export function watchEffectOnce(cond: Ref, cb: WatchEffect) { const stop = watchEffect((onCleanup) => { if (cond.value) { nextTick(() => stop()); cb(onCleanup); } }); return stop; }