- jQuery Design Patterns
- Thodoris Greasidis
- 200字
- 2021-07-16 12:52:27
Summary
In this chapter, we learned about the Observer Pattern, how it can make the HTML code of our web pages cleaner, and the way that decouples it from our application's code. We learned how jQuery adds a protection layer to its methods in order to protect us from undetected memory leaks, which may occur by adding observers to elements, when not using the jQuery DOM manipulation methods.
We also tried the Delegated Event Observer Pattern variant and used it to rewrite our initial example. We compared the two implementations and saw how it simplifies writing code that applies to many page elements when they are generated after the page has been loaded. Finally, we had a comparison regarding the memory consumption of the plain Observer Pattern with its delegate variant and highlighted how it also lessens the memory consumption of our page by reducing the required number of attached observers.
Now that we have completed our introduction on how the Observer Pattern is used to listen to user actions, we can move on to the next chapter where we will learn about custom events and the Publish/Subscribe Pattern and the way they can lead to a more decoupled implementation.
- Visual C++程序設計學習筆記
- 零起步玩轉掌控板與Mind+
- C# Programming Cookbook
- NLTK基礎教程:用NLTK和Python庫構建機器學習應用
- Java加密與解密的藝術(第2版)
- Xamarin.Forms Projects
- JavaScript by Example
- AutoCAD VBA參數化繪圖程序開發與實戰編碼
- Working with Odoo
- C#實踐教程(第2版)
- Android Wear Projects
- Visualforce Developer’s guide
- Visual Basic程序設計習題與上機實踐
- JBoss:Developer's Guide
- Arduino機器人系統設計及開發