export default class Banner {
    public static preloadImages(
        data: Banner.data[],
        imagesLoaded: { current: boolean }
    ) {
        let loadedCount = 0;
        const totalImages = data.length;

        const handleImageLoad = () => {
            loadedCount++;
            if (loadedCount === totalImages) {
                imagesLoaded.current = true;
            }
        };

        data.forEach((item) => {
            const img = new Image();
            img.src = item.img;
            img.onload = handleImageLoad;
            img.onerror = handleImageLoad;
        });
    }
}
