Skip to content

Instantly share code, notes, and snippets.

@banujan6
Last active September 4, 2021 17:06
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 banujan6/86bef573ef9e0896f25911d35fc8c075 to your computer and use it in GitHub Desktop.
Save banujan6/86bef573ef9e0896f25911d35fc8c075 to your computer and use it in GitHub Desktop.
RxJs Medium Gists
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