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

  • 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
主站蜘蛛池模板: 开封市| 沅江市| 肃宁县| 宣城市| 黑河市| 苗栗县| 泸水县| 古蔺县| 三门县| 翁牛特旗| 罗城| 重庆市| 株洲县| 江达县| 伊春市| 雅江县| 枣强县| 资中县| 大姚县| 无锡市| 盐亭县| 尉犁县| 苏州市| 扬州市| 冀州市| 宁晋县| 武邑县| 精河县| 凤庆县| 六枝特区| 台北市| 克拉玛依市| 叙永县| 阿鲁科尔沁旗| 沈阳市| 临潭县| 华蓥市| 德化县| 赤峰市| 高雄市| 涟源市|