Skip to content

yurikoex/create-subject-with-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

mimicing rxjs Subject exposing filter only

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published