Created
November 17, 2016 14:56
-
-
Save marcusradell/58e095ae698e09c359bf9a9b2f6972dc to your computer and use it in GitHub Desktop.
rxjs select stream
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
export default function create({ | |
Observable, | |
gridSelectStream, | |
newEntityResolveStream, | |
entityStoreStateStream | |
}) { | |
const newEntitySelectStream = newEntityResolveStream | |
.switchMap(function onSwitchMap(eventData) { | |
return entityStoreStateStream | |
.filter(function onFilter(entityStoreStateData) { | |
return entityStoreStateData.items[eventData.id] | |
}) | |
.map(function onMap(entityStoreStateData) { | |
return { | |
id: eventData.id, | |
item: entityStoreStateData.items[eventData.id] | |
} | |
}) | |
.take(1) | |
}) | |
return Observable | |
.merge( | |
gridSelectStream, | |
newEntitySelectStream | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment