* Push a watcher into the watcher queue. * Jobs with duplicate IDs will be skipped unless it's * pushed when the queue is being flushed.
(watcher)
| 2369 | * pushed when the queue is being flushed. |
| 2370 | */ |
| 2371 | function queueWatcher (watcher) { |
| 2372 | var id = watcher.id; |
| 2373 | if (has[id] == null) { |
| 2374 | has[id] = true; |
| 2375 | if (!flushing) { |
| 2376 | queue.push(watcher); |
| 2377 | } else { |
| 2378 | // if already flushing, splice the watcher based on its id |
| 2379 | // if already past its id, it will be run next immediately. |
| 2380 | var i = queue.length - 1; |
| 2381 | while (i >= 0 && queue[i].id > watcher.id) { |
| 2382 | i--; |
| 2383 | } |
| 2384 | queue.splice(Math.max(i, index) + 1, 0, watcher); |
| 2385 | } |
| 2386 | // queue the flush |
| 2387 | if (!waiting) { |
| 2388 | waiting = true; |
| 2389 | nextTick(flushSchedulerQueue); |
| 2390 | } |
| 2391 | } |
| 2392 | } |
| 2393 | |
| 2394 | /* */ |
| 2395 |
no test coverage detected