7.0.18 • Published 5 years ago
@dot-event/store v7.0.18
@dot-event/store
dot-event immutable store
Install
npm install dot-event @dot-event/store
Setup
const dot = require("dot-event")()
require("@dot-event/store")(dot)
Usage
dot.set("prop", "prop2", "some value")
dot.get("prop", "prop2") // "some value"
dot.merge("prop", { prop3: "another value" })
dot.get("prop") // { prop2: "some value", prop3: "another value" }
dot.delete("prop")
dot.get() // {}
Listen to store changes
Use dot.on
or dot.any
on the store
event id:
dot.on("store", "prop", () => {})
Queued update
Pass a function to dot.set
for atomic operations:
dot.set("counter", value => (value || 0) + 1)
Raw state
The raw state object is available at dot.state.store
.
Credit
Some of the immutability features were borrowed from debitoor/dot-prop-immutable.
7.0.18
5 years ago
7.0.17
5 years ago
7.0.16
5 years ago
7.0.15
5 years ago
7.0.14
5 years ago
7.0.13
5 years ago
7.0.12
5 years ago
7.0.11
5 years ago
7.0.10
5 years ago
7.0.9
5 years ago
7.0.8
5 years ago
7.0.7
5 years ago
7.0.6
5 years ago
7.0.5
5 years ago
7.0.4
5 years ago
7.0.3
5 years ago
7.0.2
5 years ago
7.0.1
5 years ago
7.0.0
5 years ago
6.0.10
5 years ago
6.0.7
5 years ago
6.0.6
5 years ago
6.0.5
5 years ago
6.0.4
5 years ago
6.0.3
5 years ago
6.0.2
5 years ago
6.0.1
5 years ago
6.0.0
5 years ago
5.9.1
5 years ago
5.9.0
5 years ago
5.8.0
5 years ago
5.6.0
5 years ago