tailieunhanh - Test Driven JavaScript Development- P16

Test Driven JavaScript Development- P16:This book is about programming JavaScript for the real world, using the techniques and workflow suggested by Test-Driven Development. It is about gaining confidence in your code through test coverage, and gaining the ability to fearlessly refactor and organically evolve your code base. It is about writing modular and testable code. It is about writing JavaScript that works in a wide variety of environments and that doesn’t get in your user’s way. | Streaming Data with Ajax and Comet In Chapter 12 Abstracting Browser Differences Ajax we saw how the XMLHttpRequest object enables web pages to take the role of interactive applications that can both update data on the back-end server by issuing POST requests as well as incrementally update the page without reloading it using GET requests. In this chapter we will take a look at technologies used to implement live data streaming between the server and client. This concept was first enabled by Netscape s Server Push in 1995 and is possible to implement in a variety of ways in today s browsers under umbrella terms such as Comet Reverse Ajax and Ajax Push. We will look into two implementations in this chapter regular polling and so-called long polling. This chapter will add some features to the interface developed in the previous chapter add a new interface and finally integrate with developed in Chapter 11 The Observer Pattern enabling us to create a streaming data client that allows JavaScript objects to observe server-side events. The goal of this exercise is twofold learning more about models for clientserver interaction and of course test-driven development. Important TDD lessons in this chapter includes delving deeper into testing asynchronous interfaces and testing timers. We will continue our discussion of stubbing and get a glimpse of the workflow and choices presented to us as we develop more than a single interface. Please purchase PDF Split-Merge on to remove this watermark. From the Library of 294 Streaming Data with Ajax and Comet Polling for Data Although one-off requests to the server can enable highly dynamic and interesting applications it doesn t open up for real live applications. Applications such as Facebook s and GTalk s in-browser chats are examples of applications that cannot make sense without a constant data stream. Other features such as stock tickers auctions and .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.