Refactoring layoutManagerActionStore. It now supports an uuid field.

layoutManagerVisibilityStore is now a derived field from layoutManagerActionStore.
This commit is contained in:
David Négrier 2021-08-05 11:19:28 +02:00
parent 92fee33b64
commit 87e4367455
4 changed files with 42 additions and 53 deletions

View file

@ -1,26 +1,5 @@
<script lang="ts">
import { layoutManagerActionStore } from "../../Stores/LayoutManagerStore";
import { onDestroy, onMount } from "svelte";
import { get } from "svelte/store";
onMount(() => {
for (const action of get(layoutManagerActionStore)) {
action.userInputManager?.addSpaceEventListner(action.callback);
if ( action.type === 'warning') {
//remove it after 10 sec
setTimeout(() => {
layoutManagerActionStore.removeAction(action);
}, 10000)
}
}
})
onDestroy(() => {
for (const action of get(layoutManagerActionStore)) {
action.userInputManager?.removeSpaceEventListner(action.callback);
}
layoutManagerActionStore.clearActions();
})
function onClick(callback: () => void) {
callback();
@ -75,4 +54,4 @@
50% {bottom: 30px;}
100% {bottom: 40px;}
}
</style>
</style>