Skip to content

Commit

Permalink
245 only set one hash string (#246)
Browse files Browse the repository at this point in the history
* feat: only one hash string

* docs: update readme
  • Loading branch information
duguyihou authored Jun 22, 2024
1 parent 52a4788 commit 4065da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ type Placeholder = {
};
```

show placeholder while loading.
show placeholder while loading, either `thumbhash` or `blurhash`

- [blurhash](https://blurha.sh/)
- [thumbhash](https://evanw.github.io/thumbhash/)
- [blurhash](https://blurha.sh/)

### `cachePolicy?: enum`

Expand Down
4 changes: 4 additions & 0 deletions src/TurboImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const TurboImage = (props: TurboImageProps) => {
...restProps
} = props;

if (placeholder && Object.keys(placeholder).length > 1) {
throw new Error('Choose one hash string, either thumbhash or blurhash');
}

const processedIndicator =
indicator && Object.keys(indicator).length !== 0
? {
Expand Down

0 comments on commit 4065da3

Please sign in to comment.