Skip to content

Instantly share code, notes, and snippets.

@RichardSilveira
Last active January 30, 2018 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardSilveira/c4515634482c38e4ac358e53abb85dad to your computer and use it in GitHub Desktop.
Save RichardSilveira/c4515634482c38e4ac358e53abb85dad to your computer and use it in GitHub Desktop.
const subject = new Rx.Subject();
const subscription = subject.subscribe({
next: valor => console.log(`observerB consumindo informação: ${valor}`),
error: err => console.log('observerB recebendo uma notificação de erro')
})
subject.next(1)
/* Cancelando a "inscrição" no Stream de eventos emitidos pela instância de `subject`.
Eventos poderão ser inseridos no Stream de subject, só não serão mais "escutados" para esse contexto*/
subscription.unsubscribe()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment