MCPcopy
hub / github.com/vuejs/core / findInsertionIndex

Function findInsertionIndex

packages/runtime-core/src/scheduler.ts:78–97  ·  view source on GitHub ↗
(id: number)

Source from the content-addressed store, hash-verified

76// watcher should be inserted immediately before the update job. This allows
77// watchers to be skipped if the component is unmounted by the parent update.
78function findInsertionIndex(id: number) {
79 let start = flushIndex + 1
80 let end = queue.length
81
82 while (start < end) {
83 const middle = (start + end) >>> 1
84 const middleJob = queue[middle]
85 const middleJobId = getId(middleJob)
86 if (
87 middleJobId < id ||
88 (middleJobId === id && middleJob.flags! & SchedulerJobFlags.PRE)
89 ) {
90 start = middle + 1
91 } else {
92 end = middle
93 }
94 }
95
96 return start
97}
98
99export function queueJob(job: SchedulerJob): void {
100 if (!(job.flags! & SchedulerJobFlags.QUEUED)) {

Callers 1

queueJobFunction · 0.85

Calls 1

getIdFunction · 0.70

Tested by

no test coverage detected