{"id":15366432,"url":"https://github.com/jasonboy/prefetch-image","last_synced_at":"2026-01-27T23:08:31.427Z","repository":{"id":20686747,"uuid":"90616696","full_name":"JasonBoy/prefetch-image","owner":"JasonBoy","description":"Prefetch all images for your web app, especially for mobile/h5 promotion pages","archived":false,"fork":false,"pushed_at":"2023-01-12T06:50:53.000Z","size":186,"stargazers_count":23,"open_issues_count":10,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T18:06:39.783Z","etag":null,"topics":["prefetch","prefetch-image","preload-images","preloader"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JasonBoy.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}},"created_at":"2017-05-08T10:40:10.000Z","updated_at":"2023-03-04T06:05:21.000Z","dependencies_parsed_at":"2023-01-14T13:06:11.026Z","dependency_job_id":null,"html_url":"https://github.com/JasonBoy/prefetch-image","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasonBoy%2Fprefetch-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasonBoy%2Fprefetch-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasonBoy%2Fprefetch-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasonBoy%2Fprefetch-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JasonBoy","download_url":"https://codeload.github.com/JasonBoy/prefetch-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239914928,"owners_count":19717760,"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","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":["prefetch","prefetch-image","preload-images","preloader"],"created_at":"2024-10-01T13:18:46.881Z","updated_at":"2026-01-27T23:08:31.359Z","avatar_url":"https://github.com/JasonBoy.png","language":"JavaScript","readme":"# prefetch-image [![npm](https://img.shields.io/npm/v/prefetch-image.svg)](https://www.npmjs.com/package/prefetch-image)\nPrefetch all images for your web app, especially for mobile/h5 promotion pages.\n\n## Usage\n\n`npm install prefetch-image --save` or\n`yarn add prefetch-image`\n\n```javascript\nconst prefetchImages = require('prefetch-image');\n//or\n//import prefetchImages from 'prefetch-image';\n\nconst images = [\n  '/1.png',\n  '/2.jpg',\n  '/3.png',\n];\nprefetchImages(images, options)\n  .then((result) =\u003e {\n    //result is an array containing all the \"Image\" objects\n    console.log('all images loaded!');\n    //start init your page logic...\n  });\n\n// or with multiple domain object\nconst imagesOnMultipleDomains = {\n  'http://domain1.com': ['/image1.png', '/image2.png'],\n  'http://domain2.com': ['/image3.png', '/image4.png'],\n};\nprefetchImages(imagesOnMultipleDomains, options)\n  .then((results) =\u003e {\n    //result is an array containing all the \"Image\" objects grouped by domains, e.g\n    //results = [${domain1ImagesArray}, ${domain2ImagesArray}]\n    console.log('all images loaded!');\n    //start init your page logic...\n  });\n```\n\u003e Don't forget to add `Cache-Control` for your assets\n\n### Options\n\n- concurrency: number of images be loading concurrently on each domain, default: 6\n- debug: boolean, default false\n\n## LICENSE\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonboy%2Fprefetch-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonboy%2Fprefetch-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonboy%2Fprefetch-image/lists"}