Refactoring next part

This commit is contained in:
Samuel Andert
2023-08-04 11:12:24 +02:00
parent c0d29e784a
commit 4a01649087
6 changed files with 26 additions and 29 deletions

View File

@ -1,19 +1,16 @@
<script>
export let me;
export let services;
export let store;
export let data;
export let machineService;
let childStore;
let childData;
$: if (me.do) {
childStore = me.do.core.subscribeComposer('@ComposerBob');
childData = me.do.core.subscribeData('@ComposerBob');
}
$: {
if ($childStore && $childStore.machine.state) {
me.do.machine.send($childStore.machine.state);
if ($childData && $childData.state) {
me.do.machine.send($childData.state);
}
}
</script>
@ -21,9 +18,9 @@
<div class="p-2 border-2 border-blue-500">
<p>My ID is: {me.id}</p>
I am the parent, this is my state: {$store.machine.state}
I am the parent, this is my state: {$data.state}
<div
class="p-2 border-2"
style="background-color: {$store.machine.state}; border-radius: 50%; width: 50px; height: 50px;"
style="background-color: {$data.state}; border-radius: 50%; width: 50px; height: 50px;"
/>
</div>