MCPcopy
hub / github.com/ampproject/amphtml / promise

Method promise

src/service/timer-impl.js:105–113  ·  view source on GitHub ↗

* Returns a promise that will resolve after the delay. Optionally, the * resolved value can be provided as opt_result argument. * @param {number=} opt_delay * @return {!Promise}

(opt_delay)

Source from the content-addressed store, hash-verified

103 * @return {!Promise}
104 */
105 promise(opt_delay) {
106 return new this.win.Promise((resolve) => {
107 // Avoid wrapping in closure if no specific result is produced.
108 const timerKey = this.delay(resolve, opt_delay);
109 if (timerKey == -1) {
110 throw new Error('Failed to schedule timer.');
111 }
112 });
113 }
114
115 /**
116 * Returns a promise that will fail after the specified delay. Optionally,

Callers 15

test-cid.jsFile · 0.80
test-ad-cid.jsFile · 0.80
test-timer.jsFile · 0.80
waitForMutationObserverFunction · 0.80
test-analytics.jsFile · 0.80
test-ready.jsFile · 0.80
getTimingDataAsyncFunction · 0.80

Calls 1

delayMethod · 0.95

Tested by

no test coverage detected