Created
May 1, 2018 01:48
-
-
Save gtkatakura/972abbc2ef3e8a530d9e52ab108cc03f to your computer and use it in GitHub Desktop.
GTK Combinator
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
var GTK = func => (...args) => { | |
let result; | |
const self = (...args) => result(...args); | |
result = func(self)(...args); | |
return result; | |
} | |
var applyMiddlewares = GTK(enhancedDispatch => (middlewares, dispatch, getState) => { | |
const passThrough = { | |
getState, | |
dispatch: enhancedDispatch | |
} | |
const chain = middlewares.map(middleware => middleware(passThrough)) | |
return compose(...chain)(dispatch) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment