MCPcopy
hub / github.com/facebook/react / pop

Function pop

packages/scheduler/src/SchedulerMinHeap.js:27–40  ·  view source on GitHub ↗
(heap: Heap<T>)

Source from the content-addressed store, hash-verified

25}
26
27export function pop<T: Node>(heap: Heap<T>): T | null {
28 if (heap.length === 0) {
29 return null;
30 }
31 const first = heap[0];
32 const last = heap.pop();
33 if (last !== first) {
34 // $FlowFixMe[incompatible-type]
35 heap[0] = last;
36 // $FlowFixMe[incompatible-call]
37 siftDown(heap, last, 0);
38 }
39 return first;
40}
41
42function siftUp<T: Node>(heap: Heap<T>, node: T, i: number): void {
43 let index = i;

Callers 4

advanceTimersFunction · 0.90
workLoopFunction · 0.90
advanceTimersFunction · 0.90
workLoopFunction · 0.90

Calls 2

siftDownFunction · 0.85
popMethod · 0.65

Tested by

no test coverage detected