Skip to content

Commit

Permalink
Merge pull request #48 from ridi/feature/lazy-load
Browse files Browse the repository at this point in the history
(#42) Image lazy load
  • Loading branch information
kyungmi authored Dec 14, 2017
2 parents 00f817d + 3192f08 commit 1a88857
Show file tree
Hide file tree
Showing 60 changed files with 11,253 additions and 850 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ npm install @ridi/react-webviewer

## How to use

### Initialize

Add `@ridi/react-webviewer` reducer into your reducers.
```js
import { reducers as viewerScreen } from '@ridi/react-webviewer';
Expand Down Expand Up @@ -49,7 +51,9 @@ export default ViewerPage extends Component {
};
```

Dispatch `renderSpine` action.
### Render contents

Dispatch `renderSpine` action to render `html` into the viewer.
```js
import { renderSpine } from '@ridi/react-webviewer';

Expand All @@ -58,3 +62,12 @@ const index = 0;
const html = '<h1>hello, world</h1>';
dispatch(renderSpine(index, html));
```

If you have image contents to render lazily, dispatch `renderImages` instead of `renderSpine`.
```js
import { renderImages } from '@ridi/react-webviewer';

...
const images = [{ src: '/image_1.jpg' }, { src: '/image_2.jpg' }, ...];
dispatch(renderImages(images));
```
Loading

0 comments on commit 1a88857

Please sign in to comment.