Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Created April 24, 2019 07:05
Show Gist options
  • Save Mayankgupta688/fd8e5d1bf3fab2df838699f2eca8b858 to your computer and use it in GitHub Desktop.
Save Mayankgupta688/fd8e5d1bf3fab2df838699f2eca8b858 to your computer and use it in GitHub Desktop.
import { Observable } from 'rxjs';
var randomNumberGenerator = Observable.create(function(observer) {
observer.next(Math.floor(Math.random() * 100));
observer.next(Math.floor(Math.random() * 100));
observer.next(Math.floor(Math.random() * 100));
observer.next(Math.floor(Math.random() * 100));
observer.next(Math.floor(Math.random() * 100));
observer.next(Math.floor(Math.random() * 100));
observer.next(Math.floor(Math.random() * 100));
});
randomNumberGenerator.subscribe(function(value) {
console.log("Value from the Simple Observable: " + value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment