Last active
September 4, 2021 17:06
-
-
Save banujan6/86bef573ef9e0896f25911d35fc8c075 to your computer and use it in GitHub Desktop.
RxJs Medium Gists
This file contains hidden or 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 observable = new Observable(subscriber => { | |
subscriber.next("First State / Data of Observable"); // Notifiying first state | |
subscriber.next("Second State / Data of Observable"); // Notifiying second state | |
subscriber.next("Third State / Data of Observable"); // Notifiying third state | |
// Just waiting 5 seconds | |
setTimeout(() => { | |
subscriber.next("Fourth State / Data of Observable"); // Notifiying fourth state | |
subscriber.complete(); // Notifiying that the is no more data to notify | |
}, 5000); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment