mimicing rxjs Subject exposing filter only. Attempts to create a small webpacked file using rxjs/Subject is currently too hard to 'patch'
yarn add create-subject-with-filter
const {
next: newMessage,
subscribe: handleMessage,
filter: filterMessage
} = createSubject()
//do something
handleMessage(msg => bar(msg))
//Send message
newMessage({payload:'bar'})
//filter the subscription
const filtered = filterMessage(msg => payload==='foo')
//subscribe and get the subscription back
const subscription = filtered.subscribe(msg => foo(msg))
///unsubscribe
subscription.unsubscribe()