You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>A JavaScript pattern and antipattern code collection that covers function patterns, jQuery patterns, design patterns, general patterns, literals and constructor patterns, object creation patterns (<em>upcoming</em>), code reuse patterns (<em>upcoming</em>), DOM and browser patterns (<em>upcoming</em>).</p>
61
+
<p>A JavaScript pattern and antipattern code collection that covers function patterns, jQuery patterns, design patterns, general patterns, literals and constructor patterns, object creation patterns, code reuse patterns (<em>upcoming</em>), DOM and browser patterns (<em>upcoming</em>).</p>
50
62
<p><ahref="http://www.blog.highub.com/tag/jsPatternRoundUp/" target="_blank">Weekly roundups</a> (pattern updates) will be regularly <ahref="http://twitter.com/shichuan" target="_blank">tweeted</a>.</p>
51
63
</section>
52
-
<section>
64
+
<sectionid="function-patterns">
53
65
<h2>Function Patterns</h2>
54
66
<h3>API Patterns</h3>
55
67
<ul>
@@ -73,7 +85,7 @@ <h3>Performance patterns</h3>
73
85
</ul>
74
86
</section>
75
87
76
-
<section>
88
+
<sectionid="jquery-patterns">
77
89
<h2>jQuery Patterns</h2>
78
90
<ul>
79
91
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/requery.html" target="_blank">requery</a> - avoid requery by using jQuery chaining</li>
@@ -94,7 +106,7 @@ <h3>Selector</h3>
94
106
</ul>
95
107
</section>
96
108
97
-
<sectionid="literals-and-constructors">
109
+
<sectionid="literals-and-constructor">
98
110
<h2>Literals and Constructors Patterns</h2>
99
111
<ul>
100
112
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/object-literal.html" target="_blank">Object literal</a> - use the simpler and reliable object literal instead of new Object();</li>
@@ -106,7 +118,7 @@ <h2>Literals and Constructors Patterns</h2>
106
118
</ul>
107
119
</section>
108
120
109
-
<section>
121
+
<sectionid="design-patterns">
110
122
<h2>Design Patterns</h2>
111
123
<h3>Creational</h3>
112
124
<ul>
@@ -131,7 +143,7 @@ <h3>Behavioral</h3>
131
143
</ul>
132
144
</section>
133
145
134
-
<section>
146
+
<sectionid="general-patterns">
135
147
<h2>General Patterns</h2>
136
148
<ul>
137
149
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/minimizing-globals.html" target="_blank">Minimizing Globals</a> - create and access a global variable in a browser environment</li>
@@ -150,6 +162,24 @@ <h2>General Patterns</h2>
150
162
</ul>
151
163
</section>
152
164
165
+
<sectionid="object-creation-patterns">
166
+
<h2>Object Creation Patterns</h2>
167
+
<ul>
168
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/namespace.html" target="_blank">Namespace</a> - namespaces help reduce the number of globals required and avoid naming collisions or excessive name prefixing</li>
169
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/declaring-dependencies.html" target="_blank">Declaring Dependencies</a> - it's good to declare the modules your code relies on at the top</li>
170
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/private-properties-and-methods.html" target="_blank">Private Properties and Methods</a> - JavaScript doesn't have special syntax for private members, you can implement them using a closure</li>
171
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/revelation.html" target="_blank">Revelation Pattern</a> - it is about having private methods, which you also expose as public methods</li>
172
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/revealing-module.html" target="_blank">Revealing Module</a> - all the methods are kept private and you only expose those that you decide at the end</li>
173
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/constructor-creation-module.html" target="_blank">Modules That Create Constructors</a> - the immediate function that wraps the module will return a function at the end</li>
174
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/sandbox.html" target="_blank">Sandbox</a> - it provides an environment for the modules to work without affecting other modules and their personal sandboxes</li>
175
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/public-static-members.html" target="_blank">Public Static Members</a> - accessible outside the constructor</li>
176
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/private-static-members.html" target="_blank">Private Static Members</a> - shared by all the objects with the same constructor function and not accessible outside the constructor</li>
177
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/object-constants.html" target="_blank">Object Constants</a> - an implementation of a contant object provides set, inDefined and get methods</li>
178
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/chaining.html" target="_blank">Chaining Pattern</a> - it enables you to call methods on an object one after the other</li>
179
+
<li><ahref="https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/sugar-method.html" target="_blank">method() Method</a> - adding convenient funcationality to a language</li>
0 commit comments