Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 1f646f5

Browse files
committed
Merge pull request #45 from garlicnation/flushCleanup
Remove locally defined animationFrameFlush
2 parents 8c3aa77 + ec76472 commit 1f646f5

File tree

3 files changed

+9
-66
lines changed

3 files changed

+9
-66
lines changed

test/core-ajax-progress.html

-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@
4343
// whether to attach an event listener.
4444
xhr['onprogress'] = null;
4545
};
46-
var animationFrameFlush = function(callback) {
47-
requestAnimationFrame(function(){
48-
flush(callback);
49-
})
50-
};
5146
var progressEvent = function(lengthComputable, loaded, total) {
5247
var progress = new ProgressEvent('progress', {
5348
lengthComputable: lengthComputable,

test/core-ajax-race.html

-7
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,18 @@
4444
xhr.onCreate = function (xhr) {
4545
requests.push(xhr);
4646
};
47-
var animationFrameFlush = function(callback) {
48-
requestAnimationFrame(function(){
49-
flush(callback);
50-
})
51-
};
5247

5348
// Make request1, then request2. request2 returns first, followed by request1.
5449
async.series([
5550
function(cb) {
5651
ajax.url="http://example.org/request1"
5752
cb();
5853
},
59-
flush,
6054
animationFrameFlush,
6155
function(cb) {
6256
ajax.url="http://example.org/request2"
6357
cb();
6458
},
65-
flush,
6659
animationFrameFlush,
6760
function(cb) {
6861
requests[0].respond(200, headers, body("http://example.org/request2"));

test/core-ajax.html

+9-54
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@
5252
ajax.auto = true;
5353
cb();
5454
},
55-
flush,
56-
function(cb) {
57-
requestAnimationFrame(function(){
58-
cb();
59-
});
60-
},
55+
animationFrameFlush,
6156
function(cb){
6257
requests[0].respond(200, headers, "test text");
6358
cb();
@@ -80,12 +75,7 @@
8075
ajax.auto = true;
8176
cb();
8277
},
83-
flush,
84-
function(cb) {
85-
requestAnimationFrame(function(){
86-
cb();
87-
});
88-
},
78+
animationFrameFlush,
8979
function(cb){
9080
requests[0].respond(200, headers,
9181
"<note>" +
@@ -116,12 +106,7 @@
116106
ajax.auto = true;
117107
cb();
118108
},
119-
flush,
120-
function(cb) {
121-
requestAnimationFrame(function(){
122-
cb();
123-
});
124-
},
109+
animationFrameFlush,
125110
function(cb){
126111
requests[0].respond(200, headers,
127112
'{"object" : {"list" : [2, 3, {"key": "value"}]}}');
@@ -147,12 +132,7 @@
147132
ajax.auto = true;
148133
cb();
149134
},
150-
flush,
151-
function(cb) {
152-
requestAnimationFrame(function(){
153-
cb();
154-
});
155-
},
135+
animationFrameFlush,
156136
function(cb){
157137
var buf = new ArrayBuffer(8*4);
158138
var resp = new Int32Array(buf);
@@ -185,12 +165,7 @@
185165
ajax.url = "http://example.com/auto";
186166
cb();
187167
},
188-
flush,
189-
function(cb) {
190-
requestAnimationFrame(function(){
191-
cb();
192-
});
193-
},
168+
animationFrameFlush,
194169
function(cb){
195170
assert.equal(requests.length, 1);
196171
cb();
@@ -203,12 +178,7 @@
203178
ajax.params = {param: "value"};
204179
cb();
205180
},
206-
flush,
207-
function(cb) {
208-
requestAnimationFrame(function(){
209-
cb();
210-
});
211-
},
181+
animationFrameFlush,
212182
function(cb){
213183
assert.equal(requests.length, 1);
214184
cb();
@@ -222,12 +192,7 @@
222192
ajax.body = "bodystuff";
223193
cb();
224194
},
225-
flush,
226-
function(cb) {
227-
requestAnimationFrame(function(){
228-
cb();
229-
});
230-
},
195+
animationFrameFlush,
231196
function(cb){
232197
assert.equal(requests.length, 1);
233198
cb();
@@ -247,24 +212,14 @@
247212
ajax.auto = false;
248213
cb();
249214
},
250-
flush,
251-
function(cb) {
252-
requestAnimationFrame(function(){
253-
cb();
254-
});
255-
},
215+
animationFrameFlush,
256216
function(cb){;
257217
ajax.handleAs = 'text';
258218
ajax.url = "http://example.com/text"
259219
ajax.auto = true;
260220
cb();
261221
},
262-
flush,
263-
function(cb) {
264-
requestAnimationFrame(function(){
265-
cb();
266-
});
267-
}
222+
animationFrameFlush,
268223
], done);
269224
responded = false;
270225
});

0 commit comments

Comments
 (0)