Skip to content

Instantly share code, notes, and snippets.

@Mulperi
Created May 22, 2018 09:30
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 Mulperi/b76a42814747f469a1613096084b2b2e to your computer and use it in GitHub Desktop.
Save Mulperi/b76a42814747f469a1613096084b2b2e to your computer and use it in GitHub Desktop.
Simple Observable Test
const { from } = require("rxjs");
const fetchData = () => {
return from(new Promise((resolve, reject) => {
setTimeout(() => {
resolve({ id: "abc123", name: "John Rambo" });
}, 2000);
})
);
}
fetchData().subscribe(
data => { console.log(data) },
error => { console.log(error) },
() => { console.log("complete") }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment