subject-with-filter

1.0.0 • Public • Published

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()
 

Package Sidebar

Install

npm i subject-with-filter

Weekly Downloads

1

Version

1.0.0

License

Apache-2.0

Unpacked Size

22.1 kB

Total Files

8

Last publish

Collaborators

  • jtlunsford