"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./micro-task.js");exports.disposables=function t(){let r=[],n={addEventListener:(e,t,r,s)=>(e.addEventListener(t,r,s),n.add((()=>e.removeEventListener(t,r,s)))),requestAnimationFrame(){let e=requestAnimationFrame(...arguments);return n.add((()=>cancelAnimationFrame(e)))},nextFrame(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.requestAnimationFrame((()=>n.requestAnimationFrame(...t)))},setTimeout(){let e=setTimeout(...arguments);return n.add((()=>clearTimeout(e)))},microTask(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];let a={current:!0};return e.microTask((()=>{a.current&&r[0]()})),n.add((()=>{a.current=!1}))},style(e,t,r){let n=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:r}),this.add((()=>{Object.assign(e.style,{[t]:n})}))},group(e){let r=t();return e(r),this.add((()=>r.dispose()))},add:e=>(r.includes(e)||r.push(e),()=>{let t=r.indexOf(e);if(t>=0)for(let e of r.splice(t,1))e()}),dispose(){for(let e of r.splice(0))e()}};return n};
//# sourceMappingURL=disposables.js.map
