subject-with-filter
v1.0.0
Published
mimicing rxjs Subject exposing filter only
Downloads
9
Maintainers
Readme
create-subject-with-filter
mimicing rxjs Subject exposing filter only. Attempts to create a small webpacked file using rxjs/Subject is currently too hard to 'patch'
Install
yarn add create-subject-with-filter
Usage
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()