1
0
Fork
You've already forked supercharged-store
0
svelte-store but in VanillaJS
  • JavaScript 63.9%
  • TypeScript 32.3%
  • HTML 3.8%
2022年07月22日 09:15:27 +02:00
example feat: add docs && example 2022年07月09日 10:48:33 +02:00
.gitignore [feature] push 2022年06月22日 14:37:37 +02:00
.npmignore fix: add files 2022年07月22日 09:07:32 +02:00
index.js feat: add docs && example 2022年07月09日 10:48:33 +02:00
index.ts [feature] push 2022年06月22日 14:37:37 +02:00
LICENSE Initial commit 2022年06月22日 12:27:07 +02:00
package-lock.json fix: change name 2022年07月22日 09:14:13 +02:00
package.json fix: change name 2022年07月22日 09:14:13 +02:00
README.md fix: push 2022年07月22日 09:15:27 +02:00

supercharged-store · npm version

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