on-popup-reopen.mjs 343 B

12345678910111213141516
  1. import { inject, watch } from "vue";
  2. const POPUP_TOGGLE_KEY = Symbol();
  3. function onPopupReopen(callback) {
  4. const popupToggleStatus = inject(POPUP_TOGGLE_KEY, null);
  5. if (popupToggleStatus) {
  6. watch(popupToggleStatus, (show) => {
  7. if (show) {
  8. callback();
  9. }
  10. });
  11. }
  12. }
  13. export {
  14. POPUP_TOGGLE_KEY,
  15. onPopupReopen
  16. };