Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fa4539c

Browse files
chaining
1 parent 00ba823 commit fa4539c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎05-object-creation.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ new SandBox('dependencies', 'here', function(box){
137137
* passed in callback function is you isolated environment
138138
* you initiate multiple Sandbox object and even nest them
139139
* you can name the constructor appropriately (instead of Sandbox)
140+
* YUI (now dead) used this
140141

141142
## implementing the sandbox pattern
142143

@@ -162,3 +163,11 @@ new SandBox('dependencies', 'here', function(box){
162163
* no real way to do it in ES5
163164
* just naming convention: all caps, and also worth making sure they're static
164165
* ```const``` keyword coming in ES6
166+
167+
## chaining
168+
169+
* methods (that may not have a meaningful return value) returning this
170+
* allows calling methods in a chain in a single expression
171+
* pros: save some typing, more concise, small and focused methods
172+
* cons: may get a bit harder to debug - lot happening on a single line
173+
* JQuery uses it

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /