supercharged-store
v1.0.0
Published
svelte-store in VanillaJS
Downloads
1
Maintainers
Readme
supercharged-store
svelte-store
in VanillaJS
Usage
- Real examples in
/example
Create a store
import { makeStore } from "../index.js";
export const myStore = makeStore({ foo: "bar" });
Subscribe to a store
import { myStore } from "./actualStores.js";
myStore.subscribe((currentNewValue) => {
console.log("new value in", currentNewValue);
});
Set new value
import { myStore } from "./actualStores.js";
myStore.set("New Value");
Update the value (using the previous value)
import { myStore } from "./actualStores.js";
myStore.update((oldValue) => {
return oldValue.toString() + "updated";
});
License
Licensed under the MIT License - LICENSE