- 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
推薦閱讀
- C#程序設(shè)計實訓(xùn)指導(dǎo)書
- 摩登創(chuàng)客:與智能手機和平板電腦共舞
- 深入理解Android:Wi-Fi、NFC和GPS卷
- 精通Python自動化編程
- C/C++數(shù)據(jù)結(jié)構(gòu)與算法速學(xué)速用大辭典
- C語言程序設(shè)計習(xí)題與實驗指導(dǎo)
- Elasticsearch搜索引擎構(gòu)建入門與實戰(zhàn)
- Python程序設(shè)計:基礎(chǔ)與實踐
- Real-time Analytics with Storm and Cassandra
- PHP面試一戰(zhàn)到底
- RPA開發(fā):UiPath入門與實戰(zhàn)
- Kubernetes進(jìn)階實戰(zhàn)(第2版)
- Go底層原理與工程化實踐
- 超簡單:用Python讓Excel飛起來·核心模塊語法詳解篇
- Arduino Computer Vision Programming