Skip to content

Instantly share code, notes, and snippets.

@lanwin
Created June 7, 2016 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanwin/7ca2df3b9b582acfc66530f31790d483 to your computer and use it in GitHub Desktop.
Save lanwin/7ca2df3b9b582acfc66530f31790d483 to your computer and use it in GitHub Desktop.
Redux devtools extension with mori
<!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>
@lanwin
Copy link
Author

lanwin commented Jun 8, 2016

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.

@lanwin
Copy link
Author

lanwin commented Jun 8, 2016

Check it. Works like a charm 💃 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment