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

Method nextTask_

src/chunk.js:378–390  ·  view source on GitHub ↗

* Returns the next task that hasn't been run yet. * If `opt_dequeue` is true, remove the returned task from the queue. * @param {boolean=} opt_dequeue * @return {?Task} * @private

(opt_dequeue)

Source from the content-addressed store, hash-verified

376 * @private
377 */
378 nextTask_(opt_dequeue) {
379 let t = this.tasks_.peek();
380 // Dequeue tasks until we find one that hasn't been run yet.
381 while (t && t.state !== TaskState_Enum.NOT_RUN) {
382 this.tasks_.dequeue();
383 t = this.tasks_.peek();
384 }
385 // If `opt_dequeue` is true, remove this task from the queue.
386 if (t && opt_dequeue) {
387 this.tasks_.dequeue();
388 }
389 return t;
390 }
391
392 /**
393 * Run a task.

Callers 2

execute_Method · 0.95
schedule_Method · 0.95

Calls 2

peekMethod · 0.45
dequeueMethod · 0.45

Tested by

no test coverage detected