import { useRef as o, useEffect as s } from "react";
import { microTask as u } from "../utils/micro-task.js";
import { useEvent as f } from "./use-event.js";
function a(t) {
  let r = f(t), e = o(!1);
  s(() => (e.current = !1, () => {
    e.current = !0, u(() => {
      e.current && r();
    });
  }), [r]);
}
export {
  a as useOnUnmount
};
