Название: Understanding jаvascript Promises Автор: Nicholas C. Zakas Издательство: Leanpub Год: 2022-02-19 Страниц: 90 Язык: английский Формат: pdf (true), mobi, epub Размер: 10.3 MB
Learn all about jаvascript promises from veteran jаvascript author Nicholas C. Zakas.
Since promises were added to jаvascript in 2015, they have become an integral part of the language. A good understanding of how promises work is more important than ever in becoming a proficient jаvascript developer. This book is written to introduce the promises and their intricacies in a straightforward, easy to read format. Each chapter is filled with practical, real-world examples using the techniques discussed, and all examples are available for download with your purchase.
One of the most powerful aspects of jаvascript is how easily it handles asynchronous programming. As a language created for the web, jаvascript needed to respond to user interactions such as clicks and key presses from the beginning, and so event handlers such as onclick were created. Event handlers allowed developers to specify a function to execute at some later point in time in reaction to an event.
Node.js further popularized asynchronous programming in jаvascript by using callback functions in addition to events. As more and more programs started using asynchronous programming, events and callbacks were no longer sufficient to support everything developers wanted to do. Promises are the solution to this problem.
Promises are another option for asynchronous programming, and they work like futures and deferreds do in other languages. A promise specifies some code to be executed later (as with events and callbacks) and also explicitly indicates whether the code succeeded or failed at its job. You can chain promises together based on success or failure in ways that make your code easier to understand and debug.
The goal of this book is to explain how jаvascript promises work while giving practical examples of when to use them. All new asynchronous jаvascript APIs will be built with promises going forward, and so promises are a central concept to understanding jаvascript as a whole. My hope is that this book will give you the information you need to successfully use promises in your projects.
What you'll learn:
Which parts of promises are synchronous and which are asynchronous How to effectively use promise chains to simplify your code The best way to catch errors in promises How to create your own promises Ways to work with multiple promises at once How async functions and await expression hide promise complexities What happens to rejected promises without rejection handlers
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.