7.0.18 • Published 6 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
6 years ago
7.0.17
6 years ago
7.0.16
6 years ago
7.0.15
6 years ago
7.0.14
6 years ago
7.0.13
6 years ago
7.0.12
6 years ago
7.0.11
6 years ago
7.0.10
6 years ago
7.0.9
6 years ago
7.0.8
6 years ago
7.0.7
6 years ago
7.0.6
6 years ago
7.0.5
6 years ago
7.0.4
7 years ago
7.0.3
7 years ago
7.0.2
7 years ago
7.0.1
7 years ago
7.0.0
7 years ago
6.0.10
7 years ago
6.0.7
7 years ago
6.0.6
7 years ago
6.0.5
7 years ago
6.0.4
7 years ago
6.0.3
7 years ago
6.0.2
7 years ago
6.0.1
7 years ago
6.0.0
7 years ago
5.9.1
7 years ago
5.9.0
7 years ago
5.8.0
7 years ago
5.6.0
7 years ago