好书推荐 好书速递 排行榜 读书文摘

Async JavaScript

Async JavaScript
作者:Trevor Burnham
副标题:Build More Responsive Apps with Less Code
出版社:Pragmatic Bookshelf
出版年:2012-12
ISBN:9781937785277
行业:其它
浏览数:5

内容简介

With Async JavaScript, you’ll develop a deeper understanding of the JavaScript language. You’ll start with a ground-up primer on the JavaScript event model—key to avoiding many of the most common mistakes JavaScripters make. From there you’ll see tools and design patterns for turning that conceptual understanding into practical code.

The concepts in the book are illustrated with runnable examples drawn from both the browser and the Node.js server framework, incorporating complementary libraries including jQuery, Backbone.js, and Async.js. You’ll learn how to create dynamic web pages and highly concurrent servers by mastering the art of distributing events to where they need to be handled, rather than nesting callbacks within callbacks within callbacks.

Async JavaScript will get you up and running with real web development quickly. By the time you’ve finished the Promises chapter, you’ll be parallelizing Ajax requests or running animations in sequence. By the end of the book, you’ll even know how to leverage Web Workers and AMD for JavaScript applications with cutting-edge performance. Most importantly, you’ll have the knowledge you need to write async code with confidence.

What You Need:

Basic knowledge of JavaScript is recommended. If you feel that you’re not up to speed, see the “Resources for Learning JavaScript” section in the preface.

......(更多)

作者简介

Trevor Burnham is a JavaScript developer for HubSpot in Cambridge, MA. He speaks at conferences including RailsConf, Øredev, and FluentConf. His first book, CoffeeScript: Accelerated JavaScript Development, was published by Pragmatic Bookshelf. You can follow him on Twitter at @TrevorBurnham.

......(更多)

目录

Contents and Extracts

Acknowledgments

Introduction

Trouble in Paradise

Who Is This Book For?

Resources for Learning JavaScript

Where to Turn for Help?

Running the Code Examples

Code Style in This Book

A Word on altJS

Resources for This Book

Understanding JavaScript Events

Scheduling Events

Types of Async Functions

Writing Async Functions

Handling Async Errors

Un-nesting Callbacks

What We’ve Learned

Distributing Events

PubSub

Evented Models

Custom jQuery Events

What We’ve Learned

Promises and Deferreds excerpt

A Very Brief History of Promises

Making Promises

Passing Data to Callbacks

Progress Notifications

Combining Promises

Binding to the Future with pipe

jQuery vs. Promises/A

Replacing Callbacks with Promises

What We’ve Learned

Flow Control with Async.js

The Async Ordering Problem

Async Collection Methods

Organizing Tasks with Async.js

Dynamic Async Queuing

Minimalist Flow Control with Step

What We’ve Learned

Multithreading with Workers excerpt

Web Workers

Node Workers with cluster

What We’ve Learned

Async Script Loading

Limitations and Caveats

Reintroducing the <script> Tag

Programmatic Loading

What We’ve Learned

Tools for Taming JavaScript

TameJS

StratifiedJS

Kaffeine

Streamline.js

Node-Fibers

The Future of JavaScript: Generators

......(更多)

读书文摘

在基于回调函数的API中使用Promise对象最直接的方法是,生成一个Deffered对象并传递其触发器函数作为API的回调参数。

不管API形态像什么, 始终要记住的是, 只能在回调内部处理源于回调的异步错误

......(更多)

猜你喜欢

点击查看