added loading and passing of svelte state stores to the machine context
This commit is contained in:
@ -1,23 +1,17 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { coreServices } from '$lib/core/refactor/coreServices';
|
||||
|
||||
export let me;
|
||||
export let data;
|
||||
|
||||
onMount(() => {
|
||||
// coreServices.mutateData('ComposerCharly', { hello: ' this is on mount ' });
|
||||
});
|
||||
function toggle() {
|
||||
me.do.machine.send('TOGGLE');
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="border-2 border-green-500">
|
||||
<div class="w-full h-full border-2 border-green-500">
|
||||
<p>My ID is: {me.id}</p>
|
||||
my state is {$data.state}
|
||||
<h1 class="h1">I am charly</h1>
|
||||
my data.context prop: {JSON.stringify($data.context)}
|
||||
my data.context.hello prop: {JSON.stringify($data.context.hello)}
|
||||
<br />
|
||||
<button
|
||||
class="px-4 py-2 font-bold text-white bg-blue-500 rounded hover:bg-blue-700"
|
||||
@ -25,8 +19,11 @@
|
||||
>
|
||||
Toggle
|
||||
</button>
|
||||
|
||||
<!-- {#each $data.context.messages as message (message.timestamp)}
|
||||
<p>{message.text}</p>
|
||||
{/each} -->
|
||||
<div class="p-8 overflow-scroll h-1/2">
|
||||
{#if $data.context.messages}
|
||||
{#each $data.context.messages as message}
|
||||
<p>{message.text}</p>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user