Last active
January 11, 2017 03:18
-
-
Save kuy/743ba0a67b31c101c53d0f61c2cbe897 to your computer and use it in GitHub Desktop.
take event from multiple channels
This file contains hidden or 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
// From https://github.com/kuy/redux-tower/commit/9619bb7f65f147640ee8e15ecc8d26dae1b537fd#diff-f38699c88139ae09699a6830074a2af5R30 | |
function takeFromChannels(channels) { | |
return race( | |
Object.keys(channels) | |
.map(name => ([name, channels[name]])) | |
.reduce((prev, [name, ch]) => ({ ...prev, [name]: take(ch) }), {}) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment