Created
July 27, 2021 13:41
-
-
Save kylephughes/33d0ae48a6e8908c4a4899ae059746fe to your computer and use it in GitHub Desktop.
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
import { Subject } from 'rxjs' | |
const notificationSubject = new Subject() | |
// Subject is also an Observable | |
const notificationObservable = notificationSubject.asObservable() | |
const publishNotification = (value) => { | |
// multicasts a value onto the stream | |
notificationSubject.next(value) | |
} | |
export { notificationObservable, publishNotification } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment