Created
June 7, 2016 07:21
-
-
Save lanwin/7ca2df3b9b582acfc66530f31790d483 to your computer and use it in GitHub Desktop.
Redux devtools extension with mori
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<script src="/node_modules/redux/dist/redux.js" type="text/javascript"></script> | |
<script src="/node_modules/mori/mori.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
"use strict"; | |
function reducer(){ | |
return mori.hashMap('key','value'); | |
} | |
var store = Redux.createStore(reducer, null, window.devToolsExtension({ | |
select:function(state){return mori.toJs(state);} | |
})); | |
store.dispatch({type:'test'}); | |
console.log('state: ',store.getState()); | |
</script> | |
</body> | |
</html> |
Check it. Works like a charm 💃 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for fixing it this fast!!!
I am not sure about that API. For what exactly this is called? The key value thing confuses me a little bit.
mori.toJs can convert an entire state tree to plain js even if not all objects are mori collections.