{"id":16774114,"url":"https://github.com/wayou/emg","last_synced_at":"2026-04-07T08:32:41.545Z","repository":{"id":69158766,"uuid":"147371069","full_name":"wayou/emg","owner":"wayou","description":"a simple, enhanced react image component with loading spinner, fallback support and other features","archived":false,"fork":false,"pushed_at":"2018-12-01T08:24:37.000Z","size":1821,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T17:32:30.188Z","etag":null,"topics":["component","fallback","image","lazy-load-img","react","sass","typescript","ui"],"latest_commit_sha":null,"homepage":"https://wayou.github.io/emg/index.html","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/wayou.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":"2018-09-04T15:52:38.000Z","updated_at":"2018-12-01T08:23:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"daae35c6-2558-49d3-a485-f69bf2f5efb0","html_url":"https://github.com/wayou/emg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wayou/emg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayou%2Femg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayou%2Femg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayou%2Femg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayou%2Femg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wayou","download_url":"https://codeload.github.com/wayou/emg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayou%2Femg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31506562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["component","fallback","image","lazy-load-img","react","sass","typescript","ui"],"created_at":"2024-10-13T06:48:05.750Z","updated_at":"2026-04-07T08:32:41.515Z","avatar_url":"https://github.com/wayou.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"emg\n===\n\n[![CircleCI](https://circleci.com/gh/wayou/emg.svg?style=svg)](https://circleci.com/gh/wayou/emg)\n[![MIT LICENSE](https://img.shields.io/github/license/wayou/emg.svg)](./LICENSE)\n[![npm package](https://img.shields.io/npm/v/emg.svg)](https://www.npmjs.com/package/emg)\n[![npm package](https://img.shields.io/npm/dt/emg.svg)](https://www.npmjs.com/package/emg)\n\n\nA simple, enhanced react image component with loading spinner, fallback support and other features\n\n### Features\n\n- lazy loading\n- loading indicator\n- error handler and fallback placeholder\n\n\n### Installing\n\nUsing command line:\n\n```bash\n$ yarn add emg\n# or\n$ npm i -S emg\n```\n\nUsing CDN:\n\n```html\n\u003cscript src=\"//unpkg.com/emg/dist/emg.umd.js\"\u003e\u003c/script\u003e\n```\n\n\n### Usage\n\n```js\nimport Emg from 'emg';\n\nclass Example extends React.Component{\n  public render(){\n    return \u003cEmg src=\"url/for/image\"/\u003e\n  }\n}\n```\n\n\n### Options\n\n- `className`: class name\n  - type: `string`\n- `src`: url of the image to load \n  - type: `string`\n- `alt`: alt for the image \n  - type: `string`\n- `title`: title attribute for the image\n  - type: `string`\n- `style`: inline style for the image\n  - type: `React.CSSProperties`\n- `loadingImg`: show while image loading\n  - type: `string`\n- `loadErrImg`: show when failed to load the image\n  - type: `string`\n- `fallbackImg`: instead of showing an error image, show this fallback one\n  - type: `string`\n- `isLazyLoad`: whether lazy load or not. enable only when `IntersectionObserver` is supported\n  - type: `boolean`\n  - default: `false`\n- `onLoad`: `onload` handler\n  - type: `(event: Event) =\u003e void`\n- `onError`: `onerror` handler\n  - type: `(event: Event) =\u003e void`\n\n\n### Examples\n\nSee the [examples](https://wayou.github.io/emg/index.html).\n\n\n#### Run the examples\n\nclone this repo then:\n\n```bash\n$ yarn install \u0026\u0026 yarn start\n```\n\nnavigate to http://localhost:3000\n\n\n### Development\n\nFor development, clone this repo then\n\n```bash\n$ yarn install \u0026\u0026 yarn start\n```\n\nthis will start a local server then open browser and go to http://localhost:3000 to see examples in action.\n\navailable scripts:\n\n- `build`: generate budnles that are ready to publish\n- `dev`: start local server for local development\n- `lint`: run tslint \u0026 stylelint\n- `test`: test the component\n\n\n### Acknowledgement\n\n#### Lazy load\n\nLazy load using the modern [`IntersectionObserver`](https://developers.google.com/web/updates/2016/04/intersectionobserver) api.\n\nFor more info you can read [\nLazy Loading Images and Video](https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/#lazy_loading_images) from WebFundamentals.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayou%2Femg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwayou%2Femg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayou%2Femg/lists"}