Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinwoo/purescript-redux-devtools
Some bindings to work with Redux DevTools.
https://github.com/justinwoo/purescript-redux-devtools
purescript redux-devtools
Last synced: about 2 months ago
JSON representation
Some bindings to work with Redux DevTools.
- Host: GitHub
- URL: https://github.com/justinwoo/purescript-redux-devtools
- Owner: justinwoo
- License: mit
- Created: 2018-09-07T13:12:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-18T17:50:03.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T23:44:39.745Z (2 months ago)
- Topics: purescript, redux-devtools
- Language: PureScript
- Homepage:
- Size: 7.81 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PureScript-Redux-DevTools
Some bindings to work with Redux DevTools.
This doesn't do any magic and you will have to handle your own encodings to `Foreign` and whatever.
## Example usage
```purs
main :: Effect Unit
main = do
mExt <- DT.getExtension
case mExt of
Just ext -> do
log "Found extension"-- make instance
inst <- DT.connect ext (DT.mkConnectOptions {})-- feed initial state to DevTools
DT.init inst (JSON.write initialState)-- ref where i'll keep my state in this example
ref <- Ref.new initialStatelet handle' = handle inst ref
handle' (add_ 1)
handle' (sub_ 1)
handle' (add_ 1)-- listen and just print out what we get from DevTools
DT.subscribe inst (log <<< JSON.writeJSON)
Nothing -> do
error "No extension found"
where
-- handler that will modify my state ref
handle inst ref action = do
s <- Ref.modify (update action) ref
log $ "New action: " <> JSON.writeJSON action
log $ "New state: " <> JSON.writeJSON sDT.send inst { state: JSON.write s, action: JSON.write action }
```