Skip to content

Instantly share code, notes, and snippets.

@Christopher2K
Created December 18, 2017 23:27
Show Gist options
  • Save Christopher2K/b31b9ea841fbba91c8a7c2512ed1791e to your computer and use it in GitHub Desktop.
Save Christopher2K/b31b9ea841fbba91c8a7c2512ed1791e to your computer and use it in GitHub Desktop.
Create an observable
function myDataStream(observer) {
observer.next('Hello');
observer.next('Reactive');
observer.next('World');
}
const obsOne = Rx.Observable.create(myDataStream);
const subscriptionOne = obsOne.subscribe((data) => {
console.log(`Output Obs 1 : ${data}`);
});
/**
* Print:
* Output Obs 1 : Hello
* Output Obs 1 : Reactive
* Output Obs 1 : World
* /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment