|
216 | 216 | const timeoutCallback = sinon.spy(() => actualCallbacks.push(timeoutCallback));
|
217 | 217 | Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.timeOut, timeoutCallback));
|
218 | 218 | // Set of short-running debouncers enqueued in the middle of first set
|
219 |
| - const nestedCallbacks = new Array(150).fill().map((_, i) => sinon.spy(() => |
220 |
| - actualCallbacks.push(nestedCallbacks[i]))); |
| 219 | + const nestedCallbacks = []; |
| 220 | + for (let i=0; i<150; i++) { |
| 221 | + nestedCallbacks.push(sinon.spy(() => |
| 222 | + actualCallbacks.push(nestedCallbacks[i]))); |
| 223 | + } |
221 | 224 | // First set of short-running debouncers
|
222 |
| - const microtaskCallbacks = new Array(150).fill().map((_, i) => sinon.spy(() => { |
223 |
| - actualCallbacks.push(microtaskCallbacks[i]); |
224 |
| - if (i === 125) { |
225 |
| - nestedCallbacks.forEach(cb => |
226 |
| - Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb))); |
227 |
| - } |
228 |
| - })); |
| 225 | + const microtaskCallbacks = []; |
| 226 | + for (let i=0; i<150; i++) { |
| 227 | + microtaskCallbacks.push(sinon.spy(() => { |
| 228 | + actualCallbacks.push(microtaskCallbacks[i]); |
| 229 | + if (i === 125) { |
| 230 | + nestedCallbacks.forEach(cb => |
| 231 | + Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb))); |
| 232 | + } |
| 233 | + })); |
| 234 | + } |
229 | 235 | microtaskCallbacks.forEach(cb =>
|
230 | 236 | Polymer.enqueueDebouncer(Polymer.Debouncer.debounce(null, Polymer.Async.microTask, cb)));
|
231 | 237 | // Expect short before long
|
|
0 commit comments