Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Architecting Angular Applications with Redux, RxJS, and NgRx

You're reading from  Architecting Angular Applications with Redux, RxJS, and NgRx

Product type Book
Published in Mar 2018
Publisher Packt
ISBN-13 9781787122406
Pages 364 pages
Edition 1st Edition
Languages
Toc

Table of Contents (12) Chapters close

Preface Quick Look Back at Data Services for Simple Apps 1.21 Gigawatt – Flux Pattern Explained Asynchronous Programming Functional Reactive Programming RxJS Basics Manipulating Streams and Their Values RxJS Advanced Redux NgRx – Reduxing that Angular App NgRx – In Depth Other Books You May Enjoy

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.js

function getData() {
return new Promise(resolve => {
console.log("this will be printed straight away");
setTimeout(() => resolve("some data"), 3000);
});
}

// emits 'some data' after 3 seconds
getData().then(data => console.log("3 seconds later", data));

If you come from a non-RxJS background, you will most likely, at this point, think: OK, yes, that's...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}