2020-06-03 00:26:06 +02:00
|
|
|
<script>
|
|
|
|
import { onMount } from "svelte"
|
2020-08-26 18:03:30 +02:00
|
|
|
import fetchData from "./fetchData.js"
|
|
|
|
import { isEmpty } from "lodash/fp"
|
2020-06-03 00:26:06 +02:00
|
|
|
|
|
|
|
export let _bb
|
2020-08-26 18:03:30 +02:00
|
|
|
export let datasource = []
|
2020-06-03 00:26:06 +02:00
|
|
|
|
|
|
|
let target
|
|
|
|
|
2020-08-26 18:03:30 +02:00
|
|
|
onMount(async () => {
|
|
|
|
if (!isEmpty(datasource)) {
|
2020-10-09 13:24:18 +02:00
|
|
|
const data = await fetchData(datasource, _bb)
|
2020-06-03 00:26:06 +02:00
|
|
|
_bb.attachChildren(target, {
|
|
|
|
hydrate: false,
|
2020-08-26 18:03:30 +02:00
|
|
|
context: data,
|
2020-06-03 00:26:06 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2020-07-07 22:29:20 +02:00
|
|
|
<section bind:this={target} />
|