(job)
| 2013 | return start; |
| 2014 | } |
| 2015 | function queueJob(job) { |
| 2016 | if (!(job.flags & 1)) { |
| 2017 | const jobId = getId(job); |
| 2018 | const lastJob = queue[queue.length - 1]; |
| 2019 | if (!lastJob || // fast path when the job id is larger than the tail |
| 2020 | !(job.flags & 2) && jobId >= getId(lastJob)) { |
| 2021 | queue.push(job); |
| 2022 | } else { |
| 2023 | queue.splice(findInsertionIndex(jobId), 0, job); |
| 2024 | } |
| 2025 | job.flags |= 1; |
| 2026 | queueFlush(); |
| 2027 | } |
| 2028 | } |
| 2029 | function queueFlush() { |
| 2030 | if (!currentFlushPromise) { |
| 2031 | currentFlushPromise = resolvedPromise.then(flushJobs); |
no test coverage detected