Refactored composer component interface to one single $me store

This commit is contained in:
Samuel Andert
2023-08-07 11:54:27 +02:00
parent 1a8bb64ff2
commit d36a94badc
5 changed files with 35 additions and 47 deletions

View File

@ -1,26 +1,28 @@
<script>
export let me;
export let data;
let childData;
let composerBob;
$: if (me.do) {
childData = me.do.core.subscribeData('ComposerBob');
$: {
if ($me.do.core) {
composerBob = $me.do.core.subscribeData('ComposerBob');
}
}
$: {
if ($childData && $childData.state) {
me.do.machine.send($childData.state);
if ($composerBob.state) {
$me.do.machine.send($composerBob.state);
}
}
// Call testAlert
</script>
<div class="p-8 border-2 border-blue-500">
<p>My ID is: {me.id}</p>
<p>My ID is: {$me.id}</p>
My state is: {$data.state}
My state is: {$me.state}
<div
class="p-2 border-2"
style="background-color: {$data.state}; border-radius: 50%; width: 50px; height: 50px;"
style="background-color: {$me.state}; border-radius: 50%; width: 50px; height: 50px;"
/>
</div>