Skip to content

Instantly share code, notes, and snippets.

@Ibro
Created April 27, 2017 18:31
Show Gist options
  • Save Ibro/9ed6a8c9bcad724d2c49ce83848d8a8e to your computer and use it in GitHub Desktop.
Save Ibro/9ed6a8c9bcad724d2c49ce83848d8a8e to your computer and use it in GitHub Desktop.
Promise and Observable - Coding Blast - www.codingblast.com
import {Observable} from 'rxjs';
let promise = new Promise((resolve, reject) => {
console.log('Promise starts');
setTimeout(() => {
resolve('Promise - after timeout of 1500 miliseconds!');
}, 1500);
});
let source = Observable.create((observer) => {
console.log('Observable starts');
setTimeout(() => {
observer.next('Observable - after timeout of 1500 miliseconds!');
}, 1500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment