Refactored composer component interface to one single $me store
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user