karl/view/src/routes/list.svelte
2021-03-09 01:13:42 +01:00

25 lines
519 B
Svelte

<script lang="ts">
import { store as imageStore } from "../stores/images";
let images = [];
const urlCreator = window.URL || window.webkitURL;
$: if ($imageStore.length) {
images = $imageStore.map((img) => {
const blob = new Blob([img.data], { type: img.type });
const imageUrl = urlCreator.createObjectURL(blob);
return {
...img,
imageUrl,
};
});
}
</script>
{#each images as img}
<p>{img.filename}</p>
<img src={img.imageUrl} />
{/each}
<h3>List</h3>