added stateMachine to stateMachine communication

This commit is contained in:
Samuel Andert
2023-08-02 11:49:05 +02:00
parent 48903fbe7d
commit 7f57036e94
6 changed files with 147 additions and 9 deletions

View File

@ -2,15 +2,20 @@
import { getCompositeStore } from './compositeStores';
export const coreServices = {
updateStore: (mappings: Record<string, string>) => {
for (const [mappingString, value] of Object.entries(mappings)) {
const [storeID, key] = mappingString.replace('@', '').split(':');
const store = getCompositeStore(storeID);
store.update(storeData => {
storeData[key] = value;
return storeData;
});
}
// updateComposite: (mappings: Record<string, string>) => {
// for (const [mappingString, value] of Object.entries(mappings)) {
// const [storeID, key] = mappingString.replace('@', '').split(':');
// const store = getCompositeStore(storeID);
// store.update(storeData => {
// storeData[key] = value;
// return storeData;
// });
// }
// },
subscribeComposite: (mappingString: string) => {
const [storeID] = mappingString.replace('@', '').split(':');
const store = getCompositeStore(storeID);
return store;
},
testAlert: () => {
alert("core service alert")