Created
August 13, 2020 15:06
-
-
Save shivenigma/bf3484f021aaaf8a1ff695531d67928b to your computer and use it in GitHub Desktop.
Used in blog post
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 { Observable } from 'rxjs'; | |
const greeting$ = new Observable(observer => { | |
const clear = setInterval(() => { | |
observer.next('Hello, there'); | |
}, 1000); | |
// Need to handle the interval here, otherwise you'll end up in a infinitely firing observable. | |
}); | |
greeting$.subscribe(res => { | |
console.log(res); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment