Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abhishiv/atom
Simple atom structure inspired by clojure's atom. Mutations are JSON RFC 6902 patches.
https://github.com/abhishiv/atom
atom atom-structure jsonrfc6902
Last synced: 30 days ago
JSON representation
Simple atom structure inspired by clojure's atom. Mutations are JSON RFC 6902 patches.
- Host: GitHub
- URL: https://github.com/abhishiv/atom
- Owner: abhishiv
- Created: 2020-11-28T09:38:18.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-16T20:05:26.000Z (about 4 years ago)
- Last Synced: 2024-11-06T11:50:15.805Z (3 months ago)
- Topics: atom, atom-structure, jsonrfc6902
- Language: TypeScript
- Homepage: https://abhishiv.github.io/atom
- Size: 1.52 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# @gratico/atom
@gratico/atom
=====Simple atom structure inspired by clojure's atom. Mutations are JSON RFC 6902 patches.
Install and use
---------------To use run `npm install -g @gratico/atom`
import {defAtom, commitPatch, defCursor, deref, defWatchableCursor} from "@gratico/atom"
const atom = defAtom({user: {profile: {name: "John"}}})
React.useLayoutEffect(() => {
const cursor = defWatchableCursor(atom, ["user", "profile"]);
cursor.addWatch(id, handler);
return () => {
cursor.removeWatch(id);
};
}, []);```
export * from "./atom";```