forked from jchomaz/Vulture
Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
27
VApp/node_modules/vuetify/lib/components/VOverlay/requestNewFrame.mjs
generated
vendored
Normal file
27
VApp/node_modules/vuetify/lib/components/VOverlay/requestNewFrame.mjs
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
let clean = true;
|
||||
const frames = [];
|
||||
|
||||
/**
|
||||
* Schedule a task to run in an animation frame on its own
|
||||
* This is useful for heavy tasks that may cause jank if all ran together
|
||||
*/
|
||||
export function requestNewFrame(cb) {
|
||||
if (!clean || frames.length) {
|
||||
frames.push(cb);
|
||||
run();
|
||||
} else {
|
||||
clean = false;
|
||||
cb();
|
||||
run();
|
||||
}
|
||||
}
|
||||
let raf = -1;
|
||||
function run() {
|
||||
cancelAnimationFrame(raf);
|
||||
raf = requestAnimationFrame(() => {
|
||||
const frame = frames.shift();
|
||||
if (frame) frame();
|
||||
if (frames.length) run();else clean = true;
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=requestNewFrame.mjs.map
|
||||
Reference in New Issue
Block a user