MCPcopy Create free account
hub / github.com/ampproject/amphtml / enqueue

Method enqueue

src/core/data-structures/priority-queue.js:34–40  ·  view source on GitHub ↗

* Enqueues an item with the given priority. * @param {T} item * @param {number} priority

(item, priority)

Source from the content-addressed store, hash-verified

32 * @param {number} priority
33 */
34 enqueue(item, priority) {
35 if (isNaN(priority)) {
36 throw new Error('Priority must not be NaN.');
37 }
38 const i = this.binarySearch_(priority);
39 this.queue_.splice(i, 0, {item, priority});
40 }
41
42 /**
43 * Returns index at which item with `target` priority should be inserted.

Callers

nothing calls this directly

Calls 1

binarySearch_Method · 0.95

Tested by

no test coverage detected