import { derived, writable } from 'svelte/store'; /* * This is a store to set the actions in the top header. */ const actions = writable({}); export const enableTopicActions = (id) => { actions.update((actionsValue) => { actionsValue.topic = { id }; return actionsValue; }); }; export const disableTopicActions = () => { actions.update((actionsValue) => { delete actionsValue.topic; return actionsValue; }); }; export const topicActions = derived( actions, ($actions) => $actions.topic );