Skip to content

Instantly share code, notes, and snippets.

@kylephughes
Created July 27, 2021 13:41
Show Gist options
  • Save kylephughes/33d0ae48a6e8908c4a4899ae059746fe to your computer and use it in GitHub Desktop.
Save kylephughes/33d0ae48a6e8908c4a4899ae059746fe to your computer and use it in GitHub Desktop.
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