amotify
Version:
UI Component for React,NextJS,esbuild
2 lines (1 loc) • 574 B
JavaScript
import"../chunk-C5N2D3ZX.js";import{useState as n,useEffect as a,useRef as i}from"react";import{Sheet as s,RootViewController as u}from"../fn";const m=e=>{let[r,f]=n(e.pathname),t=!0;r!==e.pathname&&(t=!1,f(e.pathname));const o=i(!1);a(()=>{t&&(o.current?(s.closeAll(!0),u.fn.updateCSSProperty.reset()):o.current=!0)},[r]),t&&e.beforeCB&&e.beforeCB(location.href),a(()=>{t&&e.afterFirstCB&&e.afterFirstCB(location.href)},[]),a(()=>{t&&(setTimeout(()=>{window.dispatchEvent(new Event("resize"))},200),e.afterCB&&e.afterCB(location.href))},[r])};export{m as useRouterEffect};