{"id":19011984,"url":"https://github.com/yuketsush/imgpreload","last_synced_at":"2025-08-13T03:05:55.069Z","repository":{"id":207592299,"uuid":"719628597","full_name":"YuketsuSh/ImgPreload","owner":"YuketsuSh","description":"ImgPreload.js - a lightweight JavaScript library for fast-loading images, videos, and audio. Enhance user experiences by asynchronously preloading visual and multimedia content, ensuring smoother web navigation. Simplified API for effortless integration.","archived":false,"fork":false,"pushed_at":"2023-11-18T12:55:37.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T15:52:02.335Z","etag":null,"topics":["javascript","javascript-library","preload-images","preloader","preloading","preloading-images","preloadjs"],"latest_commit_sha":null,"homepage":"https://discord.gg/w0nderland","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YuketsuSh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-16T15:12:55.000Z","updated_at":"2024-06-04T20:12:42.000Z","dependencies_parsed_at":"2025-01-01T21:45:47.965Z","dependency_job_id":"4f479779-a730-4983-a25e-d569e3909b2a","html_url":"https://github.com/YuketsuSh/ImgPreload","commit_stats":null,"previous_names":["yuketsush/imgpreload"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/YuketsuSh/ImgPreload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YuketsuSh%2FImgPreload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YuketsuSh%2FImgPreload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YuketsuSh%2FImgPreload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YuketsuSh%2FImgPreload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YuketsuSh","download_url":"https://codeload.github.com/YuketsuSh/ImgPreload/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YuketsuSh%2FImgPreload/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270172578,"owners_count":24539386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","javascript-library","preload-images","preloader","preloading","preloading-images","preloadjs"],"created_at":"2024-11-08T19:16:21.504Z","updated_at":"2025-08-13T03:05:54.932Z","avatar_url":"https://github.com/YuketsuSh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImgPreload.js\n\n## Overview\nImgPreload.js is a lightweight JavaScript library designed to efficiently preload and display images, audio, and video files asynchronously on web pages. This library optimizes the loading process, contributing to a smoother user experience by reducing loading times for visual and multimedia content.\n\n## Features\n- Asynchronously preloads images, audio, and video files to improve page loading times.\n- Enhances user experience by ensuring faster loading of visual and multimedia content.\n- Simplified API for easy integration and utilization.\n\n## API Methods\n\n### `preloadAndShowImages()`\nPreloads and displays images specified in `\u003cimg\u003e` tags with the `data-src` attribute. It also handles background images set via `data-background` attributes on HTML elements.\n\n### `preloadAndApplyBackground()`\nPreloads and applies background images to HTML elements with the `data-background` attribute.\n\n### `preloadAndShowMedia()`\nPreloads and displays audio and video files specified in `\u003caudio\u003e` and `\u003cvideo\u003e` tags with the `data-src` attribute.\n\n### `setPreloadMemory(quantity)`\nSets the memory threshold for preloading resources. This method accepts a quantity parameter representing the memory threshold in Megabytes. It sets the `data-preload-memory` attribute for elements like `\u003cimg\u003e`, `\u003caudio\u003e`, and `\u003cvideo\u003e`.\n\n### `setPreloadCacheSize(size)`\nSets the maximum cache size for preloading resources. It accepts a size parameter representing the maximum number of elements to be stored in the cache. This method sets the `data-preload-cache-size` attribute for elements like `\u003cimg\u003e`, `\u003caudio\u003e`, and `\u003cvideo\u003e`.\n\n### `setCacheDuration(durationInMilliseconds)`\nSets the cache duration for resources in milliseconds. It accepts a durationInMilliseconds parameter representing the cache duration in milliseconds. This method sets the `data-cache-duration` attribute for elements like `\u003cimg\u003e`, `\u003caudio\u003e`, and `\u003cvideo\u003e`.\n\n### `setCacheCleanInterval(intervalInMilliseconds)`\nDefines the interval duration (in milliseconds) for cleaning the cache. If not provided, it automatically sets the cache cleaning interval to 5 minutes (300,000 milliseconds).\n\n### Example of using the New API Methods\n\n#### Setting Memory Threshold\n\n```javascript\nwindow.ImgPreload.setPreloadMemory(150); // Sets the memory threshold to 150 Megabytes.\n```\n\n#### Setting Cache Duration\n\n```javascript\nwindow.ImgPreload.setCacheDuration(60 * 60 * 1000); // 1 hour cache duration\n```\n\n#### Setting Cache Size\n\n```javascript\nwindow.ImgPreload.setPreloadCacheSize(100); // Sets the maximum cache size to 100 elements.\n```\n\n### Setting Cache Clean Interval\n\n```javascript\nwindow.ImgPreload.setCacheCleanInterval(10 * 60 * 1000); // Sets cache clean interval to 10 minutes\n```\n\nDocumentation is [here](https://github.com/YuketsuSh/ImgPreload/blob/main/docs/Configuration.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuketsush%2Fimgpreload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuketsush%2Fimgpreload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuketsush%2Fimgpreload/lists"}