Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering TypeScript - Fourth Edition

You're reading from  Mastering TypeScript - Fourth Edition

Product type Book
Published in Apr 2021
Publisher Packt
ISBN-13 9781800564732
Pages 538 pages
Edition 4th Edition
Languages
Author (1):
Nathan Rozentals Nathan Rozentals
Profile icon Nathan Rozentals

Table of Contents (19) Chapters

Preface 1. Up and Running Quickly 2. Exploring the Type System 3. Interfaces, Classes, Inheritance, and Modules 4. Generics and Advanced Type Inference 5. Asynchronous Language Features 6. Decorators 7. Integration with JavaScript 8. Strict Compiler Options 9. Using Observables to Transform Data 10. Test-Driven Development 11. Angular 12. React 13. Vue 14. Node and Express 15. An AWS Serverless API 16. Micro Front-ends 17. Other Books You May Enjoy
18. Index

Observable Subject

Thus far, we have worked with Observables that emit values and seen how to subscribe to Observable streams. The Observable itself is responsible for emitting values, and the subscribers react to values being emitted. When an Observable stream is complete, all subscribers complete their processing, and their execution stops. In essence, subscribers are alive as long as the Observable stream is emitting values.

So what if we want to keep an Observable stream open and register one or more subscribers that will wait around until a new value is emitted? Think in terms of an event bus, where multiple subscribers register their interest in a topic on an event bus, and then react as and when an event is raised that they are interested in. RxJS provides the Subject class for this express purpose.

A Subject maintains a list of listeners that have registered their interest. A Subject is also an Observable stream, and therefore listeners can subscribe to the stream...

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 ₹800/month. Cancel anytime}