Hot, cold, and warm Observables

There are hot, cold, and warm Observables. What do we actually mean by that? For starters, let's say that most things you will deal with are cold Observables. Not helping? If we say that cold Observables are lazy, does that help? No? OK, let's talk about Promises for a second. Promises are hot. They are hot because when we execute their code, it happens straight away. Let's see an example of that:

// hot-cold-warm/promise.jsfunction getData() {  return new Promise(resolve => {    console.log("this will be printed straight away");    setTimeout(() => resolve("some data"), 3000);   });}// emits 'some data' after 3 secondsgetData().then(data => console.log("3 seconds later", data));

If you come from a non-RxJS background, ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.