/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{signal as e}from"./signal.js";function l(l,a,u,t){let o=null,n=1e3;"number"==typeof a?(n=a,t=u):(o=a??null,n=u);const r=e(0);let v;const p=()=>{r.value=0,l.apply(t,v)},i=(...e)=>{o&&o.apply(t,e),v=e,n?r.value||(r.value=setTimeout(p,n)):p()};return i.remove=()=>{r.value&&(clearTimeout(r.value),r.value=0)},i.forceUpdate=()=>{r.value&&(clearTimeout(r.value),p())},i.hasPendingUpdates=()=>!!r.value,i}export{l as throttle};
