1 |
- import{Q as e,b6 as n,S as t,b7 as a,b8 as u,b9 as o}from"./index-232a7449.js";function i(e){return!!a()&&(u(e),!0)}function s(e){return"function"==typeof e?e():o(e)}const c="undefined"!=typeof window&&"undefined"!=typeof document;function l(a,u=1e3,o={}){const{immediate:l=!0,immediateCallback:r=!1}=o;let f=null;const m=e(!1);function d(){f&&(clearInterval(f),f=null)}function v(){m.value=!1,d()}function b(){const e=s(u);e<=0||(m.value=!0,r&&a(),d(),f=setInterval(a,e))}return l&&c&&b(),(n(u)||"function"==typeof u)&&i(t(u,(()=>{m.value&&c&&b()}))),i(v),{isActive:m,pause:v,resume:b}}function r(n=1e3,t={}){const{controls:a=!1,immediate:u=!0,callback:o}=t,i=e(0),s=()=>i.value+=1,c=l(o?()=>{s(),o(i.value)}:s,n,{immediate:u});return a?{counter:i,reset:()=>{i.value=0},...c}:i}export{l as a,s as b,c as i,i as t,r as u};
|