官术网_书友最值得收藏!

  • jQuery Design Patterns
  • Thodoris Greasidis
  • 161字
  • 2021-07-16 12:52:27

Chapter 3. The Publish/Subscribe Pattern

In this chapter, we will showcase the Publish/Subscribe Pattern, a design pattern quite similar to the Observer Pattern but with a more distinct role that is a better fit for more complex use cases. We will see how it differs from the Observer Pattern and how jQuery adopted some of its concepts and brought them to its Observer Pattern implementation.

Later, we will proceed and rewrite our previous chapter's example using this pattern. We will use this pattern's benefits to add some extra features and also reduce the coupling of our code with the elements of the web page.

In this chapter, we will:

  • Introduce the Publish/Subscribe Pattern
  • Learn how it differs and what advantages it has over the Observer Pattern
  • Learn how jQuery brings some of its features to its methods
  • Learn how to emit custom events with jQuery
  • Rewrite and extend the example from Chapter 2, The Observer Pattern, using this pattern
主站蜘蛛池模板: 沙坪坝区| 龙门县| 澎湖县| 文水县| 怀化市| 云林县| 新民市| 汶川县| 东平县| 崇信县| 盘锦市| 芦山县| 阿拉善左旗| 平武县| 清徐县| 临泉县| 宁乡县| 古浪县| 保山市| 蓝田县| 唐海县| 昆明市| 西充县| 古丈县| 湖南省| 绥中县| 中卫市| 刚察县| 平顶山市| 中江县| 北票市| 铜川市| 武陟县| 嘉善县| 东光县| 府谷县| 广灵县| 宜兰市| 九龙坡区| 余姚市| 阳泉市|