Название: Web API Cookbook: Level Up Your jаvascript Applications Автор: Joe Attardi Издательство: O’Reilly Media, Inc. Год: 2024 Страниц: 286 Язык: английский Формат: pdf (true), epub (true) Размер: 10.1 MB
jаvascript gives web developers great power to create rich interactive browser experiences, and much of that power is provided by the browser itself. Modern web APIs enable web-based applications to come to life like never before, supporting actions that once required browser plug-ins. Some are still in an experimental stage, but many are ready for use today.
With this hands-on cookbook, author Joe Attardi helps you explore the powerful APIs available in modern browsers and guides you through the specific tasks that they unlock. Because these features are web standards, there is comprehensive documentation available from trusted resources such as MDN Web Docs. The knowledge you'll gain is transferable across different companies and projects.
A Web API is a series of global objects and functions exposed by the browser. Your jаvascript code can use these to interact with the Document Object Model (DOM), perform network communication, integrate with native device features, and much more. A lot of the APIs covered in this book are asynchronous. When you call one of these functions or methods, you might not get the result back right away. Different APIs have different mechanisms to get the result back to you when it’s ready. The most basic asynchronous pattern is a callback function. This is a function that you pass to an asynchronous API. When the work is complete, it calls your callback with the result. Callbacks can be used on their own or as part of other asynchronous patterns.
Many newer APIs use Promises. A Promise is an object, returned from a function, that is a placeholder for the eventual result of the asynchronous action. Instead of listening for an event, you call then on a Promise object. You pass a callback function to then that is eventually called with the result as its argument. To handle errors, you pass another callback function to the Promise’s catch method. A Promise is fulfilled when the operation completes successfully, and it is rejected when there’s an error. The fulfilled value is passed as an argument to the then callback, or the rejected value is passed as an argument to the catch callback.
Supplemental material (code examples, exercises, etc.) is available for download at GitHub.com.
• Learn the breadth of functionality available in modern browser APIs • Explore future APIs that are still in an experimental stage • Discover newer elements, such as dialog that replaces the need for a third-party library • Build more powerful and interactive web applications using native APIs • Understand the permissions model used by the browser to unlock functionality such as geolocation and push notifications
Who This Book Is For: This book is intended for software developers with some experience with jаvascript who want to get the most out of the web platform. It assumes that you have a good knowledge of the jаvascript language itself: syntax, language features, and standard library functions. You should also have a working knowledge of the DOM APIs used for building interactive, browser-based jаvascript applications. There is a wide range of recipes in this book; there’s something for developers of all skill and experience levels.
Preface 1. Asynchronous APIs 2. Simple Persistence with the Web Storage API 3. URLs and Routing 4. Network Requests 5. IndexedDB 6. Observing DOM Elements 7. Forms 8. The Web Animations API 9. The Web Speech API 10. Working with Files 11. Internationalization 12. Web Components 13. UI Elements 14. Device Integration 15. Measuring Performance 16. Working with the Console 17. CSS 18. Media 19. Closing Thoughts Index
Скачать Web API Cookbook: Level Up Your jаvascript Applications
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.