I have a svelte store with a method called 'right'. When right is triggered I want the function handleNextImage in my component file to run. I am unsure how to do this properly, thanks!
import { writable, get } from 'svelte/store';
const createMyStore = () => {
const store = writable({
Rows: [],
});
const { subscribe } = store;
return {
subscribe,
right: (cb: (msg) => void) =>
update((x) => {
....
return x;
}),
};
};
export const myStore = createMyStore();
COMPONENT.SVELTE
import { myStore } from '@screens/home/myStore';
myStore.right(() => {
console.log('go right in store');
handleNextImage()
});
const handleNextImage = () => {
does a thing...
};