Book Image

TypeScript High Performance

By : Ajinkya Kher
Book Image

TypeScript High Performance

By: Ajinkya Kher

Overview of this book

<p>In a world where a tiny decrease in frames per second impacts customer engagement greatly, writing highly scalable code is more of a necessity than a luxury. Using TypeScript you get type checking during development. This gives you the power to write optimized code quickly. This book is also a solid tool to those who’re curious to understand the impact of performance in production, and it is of the greatest aid to the proactive developers who like to be cognizant of and avoid the classic pitfalls while coding.</p> <p>The book will starts with explaining the efficient implementation of basic data Structures, data types, and flow control. You will then learn efficient use of advanced language constructs and asynchronous programming. Further, you'll learn different configurations available with TSLint to improve code quality and performance. Next, we'll introduce you to the concepts of profiling and then we deep dive into profiling JS with several tools such as firebug, chrome, fiddler. Finally, you'll learn techniques to build and deploy real world large scale TypeScript applications.</p>
Table of Contents (17 chapters)
Title Page
Credits
Foreword
About the Author
Acknowlegement
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
7
Profile Deployed JS with Developer Tools and Fiddler

Promises


Promise is another popular term you would have heard before. By definition, "Promise is a future value.", meaning a promise represents a placeholder for the result of a computation, the value of which will be determined at some point in the future. Technically speaking, this value may or may not be made available in the future, implying that the computation may either resolve or reject at some point in the future.

The definition subtleties aside, if you think about it, promises are very similar to callbacks. When we pass a callback to a function, we rely on that function to call the supplied callback at some point in the future. The callback either gets called back with an error or with the result of the operation. Similarly, with promises you rely on the promise to either resolve or reject at some point in the future.

Promise can be thought of as a callback that calls the resolve function with the result of the operation in case of successful computation, or calls the reject function...