This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 3 files changed +9
-66
lines changed
3 files changed +9
-66
lines changed Original file line number Diff line number Diff line change 43
43
// whether to attach an event listener.
44
44
xhr [ 'onprogress' ] = null ;
45
45
} ;
46
- var animationFrameFlush = function ( callback ) {
47
- requestAnimationFrame ( function ( ) {
48
- flush ( callback ) ;
49
- } )
50
- } ;
51
46
var progressEvent = function ( lengthComputable , loaded , total ) {
52
47
var progress = new ProgressEvent ( 'progress' , {
53
48
lengthComputable : lengthComputable ,
Original file line number Diff line number Diff line change 44
44
xhr . onCreate = function ( xhr ) {
45
45
requests . push ( xhr ) ;
46
46
} ;
47
- var animationFrameFlush = function ( callback ) {
48
- requestAnimationFrame ( function ( ) {
49
- flush ( callback ) ;
50
- } )
51
- } ;
52
47
53
48
// Make request1, then request2. request2 returns first, followed by request1.
54
49
async . series ( [
55
50
function ( cb ) {
56
51
ajax . url = "http://example.org/request1"
57
52
cb ( ) ;
58
53
} ,
59
- flush ,
60
54
animationFrameFlush ,
61
55
function ( cb ) {
62
56
ajax . url = "http://example.org/request2"
63
57
cb ( ) ;
64
58
} ,
65
- flush ,
66
59
animationFrameFlush ,
67
60
function ( cb ) {
68
61
requests [ 0 ] . respond ( 200 , headers , body ( "http://example.org/request2" ) ) ;
Original file line number Diff line number Diff line change 52
52
ajax . auto = true ;
53
53
cb ( ) ;
54
54
} ,
55
- flush ,
56
- function ( cb ) {
57
- requestAnimationFrame ( function ( ) {
58
- cb ( ) ;
59
- } ) ;
60
- } ,
55
+ animationFrameFlush ,
61
56
function ( cb ) {
62
57
requests [ 0 ] . respond ( 200 , headers , "test text" ) ;
63
58
cb ( ) ;
80
75
ajax . auto = true ;
81
76
cb ( ) ;
82
77
} ,
83
- flush ,
84
- function ( cb ) {
85
- requestAnimationFrame ( function ( ) {
86
- cb ( ) ;
87
- } ) ;
88
- } ,
78
+ animationFrameFlush ,
89
79
function ( cb ) {
90
80
requests [ 0 ] . respond ( 200 , headers ,
91
81
"<note>" +
116
106
ajax . auto = true ;
117
107
cb ( ) ;
118
108
} ,
119
- flush ,
120
- function ( cb ) {
121
- requestAnimationFrame ( function ( ) {
122
- cb ( ) ;
123
- } ) ;
124
- } ,
109
+ animationFrameFlush ,
125
110
function ( cb ) {
126
111
requests [ 0 ] . respond ( 200 , headers ,
127
112
'{"object" : {"list" : [2, 3, {"key": "value"}]}}' ) ;
147
132
ajax . auto = true ;
148
133
cb ( ) ;
149
134
} ,
150
- flush ,
151
- function ( cb ) {
152
- requestAnimationFrame ( function ( ) {
153
- cb ( ) ;
154
- } ) ;
155
- } ,
135
+ animationFrameFlush ,
156
136
function ( cb ) {
157
137
var buf = new ArrayBuffer ( 8 * 4 ) ;
158
138
var resp = new Int32Array ( buf ) ;
185
165
ajax . url = "http://example.com/auto" ;
186
166
cb ( ) ;
187
167
} ,
188
- flush ,
189
- function ( cb ) {
190
- requestAnimationFrame ( function ( ) {
191
- cb ( ) ;
192
- } ) ;
193
- } ,
168
+ animationFrameFlush ,
194
169
function ( cb ) {
195
170
assert . equal ( requests . length , 1 ) ;
196
171
cb ( ) ;
203
178
ajax . params = { param : "value" } ;
204
179
cb ( ) ;
205
180
} ,
206
- flush ,
207
- function ( cb ) {
208
- requestAnimationFrame ( function ( ) {
209
- cb ( ) ;
210
- } ) ;
211
- } ,
181
+ animationFrameFlush ,
212
182
function ( cb ) {
213
183
assert . equal ( requests . length , 1 ) ;
214
184
cb ( ) ;
222
192
ajax . body = "bodystuff" ;
223
193
cb ( ) ;
224
194
} ,
225
- flush ,
226
- function ( cb ) {
227
- requestAnimationFrame ( function ( ) {
228
- cb ( ) ;
229
- } ) ;
230
- } ,
195
+ animationFrameFlush ,
231
196
function ( cb ) {
232
197
assert . equal ( requests . length , 1 ) ;
233
198
cb ( ) ;
247
212
ajax . auto = false ;
248
213
cb ( ) ;
249
214
} ,
250
- flush ,
251
- function ( cb ) {
252
- requestAnimationFrame ( function ( ) {
253
- cb ( ) ;
254
- } ) ;
255
- } ,
215
+ animationFrameFlush ,
256
216
function ( cb ) { ;
257
217
ajax . handleAs = 'text' ;
258
218
ajax . url = "http://example.com/text"
259
219
ajax . auto = true ;
260
220
cb ( ) ;
261
221
} ,
262
- flush ,
263
- function ( cb ) {
264
- requestAnimationFrame ( function ( ) {
265
- cb ( ) ;
266
- } ) ;
267
- }
222
+ animationFrameFlush ,
268
223
] , done ) ;
269
224
responded = false ;
270
225
} ) ;
You can’t perform that action at this time.
0 commit comments