1.0.11 • Published 5 years ago

react-image-service-worker v1.0.11

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

react-image-service-worker

react-image-service-worker is a React component, which uses service workers to load. Thereby not blocking the main thread and speeding up page load time.

Installation

Using npm

npm install react-image-service-worker

yarn add react-image-service-worker

Usage

react-image-service-worker exports one react component which takes src as a prop, and an optional prop of placeholder, style and imageClass which are applied to the img tag.

const ImageWorker = require('react-image-service-worker').default;

or

import ImageWorker from 'react-image-service-worker';

usage in code

<ImageWorker src='http://image-url' />

Props List

Prop typeRequiredtype
srcyesstring
placeholderoptionalstring or Component
styleoptionalObject
imageClassoptionalstring
containerClassoptionalstring

The above props are applied to the img tag.

Found a bug file them here.

Component in Action

Observe the page Load time at the bottom right corner in both cases.

The first is via a webworker and the second is the regular get.