@@ -84,7 +84,7 @@ function delayNew(ms) {
84
84
var delayMessage = 'Delay Resolved after ' + ms + ' milliseconds.' ;
85
85
86
86
// Your code follows...
87
- // IMPLEMENT
87
+ // IMPLEMENT #1
88
88
89
89
90
90
@@ -97,28 +97,28 @@ function simpleWrapper(value) {
97
97
// Creating Promises for simple values or synchronous function output
98
98
99
99
// We just wrap the basic value and immediately return the resolved promise.
100
- // IMPLEMENT
100
+ // IMPLEMENT #2
101
101
102
102
}
103
103
104
104
function chainSimplePromise ( value ) {
105
105
// Make a promise using our wrapper function, then look at what's inside.
106
- // IMPLEMENT
106
+ // IMPLEMENT #3
107
107
108
108
}
109
109
110
110
function stripOutMainContent ( wholePage ) {
111
111
// First we perform some basic DOM stuff to get the content:
112
112
var content = $ ( wholePage ) . find ( 'section' ) . html ( )
113
113
// But now, we need to wrap this content in a promise, so we can continue a chain...
114
- // IMPLEMENT
114
+ // IMPLEMENT #11
115
115
116
116
}
117
117
118
118
function writeArticleToDOM ( articleText ) {
119
119
$ ( 'article' ) . html ( articleText ) ;
120
120
// and, just as good form, return a promise to the end of the chain, containing articleText, so we can see the output:
121
- // IMPLEMENT
121
+ // IMPLEMENT #12
122
122
123
123
}
124
124
@@ -132,12 +132,12 @@ function doMoreStuff() {
132
132
// Now, take that promise, stripOutMainContent and then writeArticleToDOM
133
133
// NOTE: stripOutMainContent still needs to be implemented!!!
134
134
// (Wat? JQuery promises are weird... What do we do?)
135
- // IMPLEMENT:
135
+ // IMPLEMENT #9
136
136
// compoundXHR =
137
137
138
138
// Now, because this is a network operation, it can fail for all kinds of reasons.
139
139
// Handle errors with the provided 'errorLogger' function.
140
- // IMPLEMENT:
140
+ // IMPLEMENT #10
141
141
142
142
// NETWORK OPERATION ENDS
143
143
@@ -148,20 +148,20 @@ function doMoreStuff() {
148
148
// IMPLEMENT
149
149
// simplePromise =
150
150
// Now, access this promise and just log the content:
151
- // IMPLEMENT
151
+ // IMPLEMENT #6
152
152
153
153
// SIMPLE VALUE PROMISE ENDS
154
154
155
155
156
156
// TIMEOUT PROMISE
157
157
// Create a new promise based on a Timeout of 2500ms, using our promise-generating delayNew Function;
158
- // IMPLEMENT
158
+ // IMPLEMENT #7
159
159
// delayPromise =
160
160
/* ( Side-note: Alternately, we could actually use Q's convenience method for timeouts, which returns a promise:
161
161
ex.: delayPromise = Q.delay(2500) ) */
162
162
163
163
// Now, access this delayPromise and just log the content:
164
- // IMPLEMENT
164
+ // IMPLEMENT #8
165
165
166
166
// TIMEOUT PROMISE ENDS
167
167
@@ -170,9 +170,10 @@ function doMoreStuff() {
170
170
// The .all() method returns a new, aggregated, promise.
171
171
// It's resolved when an entire array of promises are each resolved.
172
172
// We want an aggregate promise composed of simplePromise, compoundXHR & delayPromise
173
- // Then, log that promise
174
- // Then, run writeToDOMAgain
175
- // IMPLEMENT
173
+ // Then, log that promise
174
+ // Then, run writeToDOMAgain
175
+ // IMPLEMENT #13 (depends on #11-#12)
176
+
176
177
}
177
178
178
179
@@ -182,17 +183,17 @@ function doMoreStuff() {
182
183
// IMPLEMENT
183
184
// docPromise =
184
185
$ ( 'document' ) . ready ( function ( ) {
185
- console . log ( 'Doc Ready. No other functions ready yet.' ) // disable me when more interesting things are happening
186
+ // console.log('Doc Ready. No other functions ready yet.') // disable me when more interesting things are happening
186
187
var readyMessage = 'Document is ready now. Go Ahead and do more promise stuff!' ;
187
188
// This is where you should resolve the docPromise, with the message above...
188
- // IMPLEMENT
189
+ // IMPLEMENT #4
189
190
190
191
} )
191
192
// Create handlers for the docPromise that:
192
- // 1. Just shows its value
193
+ // 1. Just shows its value
193
194
// 2. Uses the 'writeToDOM' function to print it out
194
195
// 3. continues our control-flow with doMoreStuff !
195
196
196
- // IMPLEMENT
197
+ // IMPLEMENT #5
197
198
198
199
0 commit comments