T
function createStore() {
const { subscribe, set, update } = writable({
test1: 1000,
test2: 1000
});
return {
subscribe,
calc: (data1, data2) => update(data => {
data = {
test1: data1,
test2: data2
};
console.log(data); // Ok
})
};
}
export const SomeStore = createStore();
// ...
SomeStore.calc(1001, 1002);
// ...
$: console.log($SomeStore); // -> undefined