Now, you're probably thinking: I'm still not sure how these patterns relate to my work. Right?
Thought so. Throughout this chapter, we've spent time examining some of the more commonly used patterns, as a means of going back to basics; after all, the secret of improving oneself is not just through writing code!
The key point here is that if you spend time developing with jQuery, then you are already using design patterns; to help reinforce what you learned, let's take a look at a few examples from within the jQuery library itself:
Note
For the purposes of this demo, I've used jQuery 2.1.1; if you use a different version, then you may find that some of the line numbers have changed.
Start by opening up a copy of
jquery.js
within a text editor of your choice—we'll begin with the classicdocument.ready()
function, which uses the Façade pattern and is run from this function at or around line 3375, as shown in the following screenshot:How many...