init component

This commit is contained in:
Robin COuret
2026-02-16 17:28:37 +01:00
parent 460c7a25e0
commit e0e50af706
4557 changed files with 666911 additions and 8 deletions

View File

@@ -0,0 +1,46 @@
import { shallowRef, onMounted, defineComponent } from 'vue';
export const DeferRendering = defineComponent({
name: 'defer-rendering',
props: {
frames: {
type: Number,
required: true
}
},
setup(props, {
slots
}) {
const currentFrame = shallowRef(0);
function checkRenderingStatus() {
if (props.frames > 0) {
if (window && window.requestAnimationFrame) {
const step = () => {
requestAnimationFrame(() => {
if (currentFrame.value < props.frames) {
currentFrame.value++;
step();
}
});
};
step();
} else {
setTimeout(() => currentFrame.value = props.frames, props.frames * 16);
}
}
}
onMounted(checkRenderingStatus);
return () => {
if (currentFrame.value >= props.frames && slots.default) {
return slots.default();
} else {
return undefined;
}
};
}
});
//# sourceMappingURL=DeferRendering.js.map