Skip to content

Instantly share code, notes, and snippets.



Last active Oct 28, 2016
What would you like to do?
Redux devtools integration with @culli/store
import {O, extend} from "@culli/base" // you can replace this with your own streaming library if you want
import Memory from "./memory"
function ReduxDevtools(initial) {
const devtools = window.__REDUX_DEVTOOLS_EXTENSION__
if (!devtools) {
return Memory(initial)
function ReduxDevtoolsStorage(actions) {
return O.create(({next}) => {
const store = devtools((s, a) => a.type === "@@INIT" ? initial : a.__.apply(s))
const disposeStore = store.subscribe(() => next(store.getState()))
const disposeActions = O.subscribe({
next: a => store.dispatch(extend({}, a.value, {__: a}))
}, actions)
return () => {
ReduxDevtoolsStorage.__culli = true // this is reserved for built-in storages only (so that we don't need to do redundant stream adapt in/out)
return ReduxDevtoolsStorage
export default ReduxDevtools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.