Skip to content

Instantly share code, notes, and snippets.

@zinevych
Created May 30, 2019 09:40
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 zinevych/816138d09349300b6557e12ab27529f0 to your computer and use it in GitHub Desktop.
Save zinevych/816138d09349300b6557e12ab27529f0 to your computer and use it in GitHub Desktop.
// create observable
const exampleObservable$ = new Observable((observer) => {
// observable execution
observer.next('example value 1');
observer.next('example value 2');
observer.next('example value 3’);
observer.complete();
})
// subscribe
const observer = exampleObservable$.subscribe((item) => {
console.log(item);
})
// unsubscribe the observer
observer.unsubscribe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment