MCPcopy Index your code
hub / github.com/ampproject/amphtml / executeAsap_

Method executeAsap_

src/chunk.js:446–467  ·  view source on GitHub ↗

* Calls `execute_()` asynchronously. * @param {?IdleDeadline} idleDeadline * @private

(idleDeadline)

Source from the content-addressed store, hash-verified

444 * @private
445 */
446 executeAsap_(idleDeadline) {
447 // If the user-agent supports isInputPending, use it to break to a macro task as necessary.
448 // Otherwise If we've spent over 5 milliseconds executing the
449 // last instruction yield back to the main thread.
450 // 5 milliseconds is a magic number.
451 if (
452 !allowLongTasks &&
453 this.bodyIsVisible_ &&
454 (this.supportsInputPending_
455 ? /** @type {!{scheduling: {isInputPending: Function}}} */ (
456 this.win_.navigator
457 ).scheduling.isInputPending()
458 : this.durationOfLastExecution_ > 5)
459 ) {
460 this.durationOfLastExecution_ = 0;
461 this.requestMacroTask_();
462 return;
463 }
464 resolved.then(() => {
465 this.boundExecute_(idleDeadline);
466 });
467 }
468
469 /**
470 * Schedule running the next queued task.

Callers 1

schedule_Method · 0.95

Calls 2

requestMacroTask_Method · 0.95
thenMethod · 0.45

Tested by

no test coverage detected