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

Method waitForExtension

src/service/extensions-impl.js:192–205  ·  view source on GitHub ↗

* Waits for the previously included extension to complete * loading/registration. * @param {string} extensionId * @param {string} version * @return {!Promise<?ExtensionDef>}

(extensionId, version)

Source from the content-addressed store, hash-verified

190 * @return {!Promise<?ExtensionDef>}
191 */
192 waitForExtension(extensionId, version) {
193 const wait = this.waitFor_(this.getExtensionHolder_(extensionId, version));
194
195 return Services.timerFor(this.win)
196 .timeoutPromise(16000, wait)
197 .catch((err) => {
198 if (!err.message.includes('timeout')) {
199 throw err;
200 }
201
202 user().error(TAG, `Waited over 16s to load extension ${extensionId}.`);
203 return wait;
204 });
205 }
206
207 /**
208 * Returns the promise that will be resolved when the extension has been

Callers 4

test-extensions.jsFile · 0.80
test-runtime.jsFile · 0.80

Calls 6

waitFor_Method · 0.95
getExtensionHolder_Method · 0.95
userFunction · 0.90
catchMethod · 0.80
timeoutPromiseMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected