<script lang="ts">
  import FileSelector from "./Base/FileSelector.svelte"
  import ExifReader from "exifreader"
  import { UIEventSource } from "../Logic/UIEventSource"

  let txt = new UIEventSource("")

  async function accept(fileList: FileList) {
    const tags = await ExifReader.load(fileList.item(0))
    console.log("All tags:", tags)
    txt.set(tags.ProjectionType.value)
  }
</script>

<FileSelector on:submit={(fileList) => accept(fileList.detail)} accept="image/jpg">
  Select file
</FileSelector>

<b>{$txt}</b>
