requestNewFrame.mjs.map 1.4 KB

1
  1. {"version":3,"file":"requestNewFrame.mjs","names":["clean","frames","requestNewFrame","cb","length","push","run","raf","cancelAnimationFrame","requestAnimationFrame","frame","shift"],"sources":["../../../src/components/VOverlay/requestNewFrame.ts"],"sourcesContent":["let clean = true\nconst frames = [] as any[]\n\n/**\n * Schedule a task to run in an animation frame on its own\n * This is useful for heavy tasks that may cause jank if all ran together\n */\nexport function requestNewFrame (cb: () => void) {\n if (!clean || frames.length) {\n frames.push(cb)\n run()\n } else {\n clean = false\n cb()\n run()\n }\n}\n\nlet raf = -1\nfunction run () {\n cancelAnimationFrame(raf)\n raf = requestAnimationFrame(() => {\n const frame = frames.shift()\n if (frame) frame()\n\n if (frames.length) run()\n else clean = true\n })\n}\n"],"mappings":"AAAA,IAAIA,KAAK,GAAG,IAAI;AAChB,MAAMC,MAAM,GAAG,EAAW;;AAE1B;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAEC,EAAc,EAAE;EAC/C,IAAI,CAACH,KAAK,IAAIC,MAAM,CAACG,MAAM,EAAE;IAC3BH,MAAM,CAACI,IAAI,CAACF,EAAE,CAAC;IACfG,GAAG,EAAE;EACP,CAAC,MAAM;IACLN,KAAK,GAAG,KAAK;IACbG,EAAE,EAAE;IACJG,GAAG,EAAE;EACP;AACF;AAEA,IAAIC,GAAG,GAAG,CAAC,CAAC;AACZ,SAASD,GAAGA,CAAA,EAAI;EACdE,oBAAoB,CAACD,GAAG,CAAC;EACzBA,GAAG,GAAGE,qBAAqB,CAAC,MAAM;IAChC,MAAMC,KAAK,GAAGT,MAAM,CAACU,KAAK,EAAE;IAC5B,IAAID,KAAK,EAAEA,KAAK,EAAE;IAElB,IAAIT,MAAM,CAACG,MAAM,EAAEE,GAAG,EAAE,MACnBN,KAAK,GAAG,IAAI;EACnB,CAAC,CAAC;AACJ"}