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

Function whenUpgraded

test/unit/preact/test-base-element-runtime.js:27–32  ·  view source on GitHub ↗

* Returns the upgraded imperative API object, once Preact has actually mounted. * * This technically works with both Bento and Legacy components, returning the * BaseElement instance in the later case. * * @param {!Element} el * @return {!Promise<!Object>}

(el)

Source from the content-addressed store, hash-verified

25 * @return {!Promise<!Object>}
26 */
27function whenUpgraded(el) {
28 return el.ownerDocument.defaultView.customElements
29 .whenDefined(el.localName)
30 .then(() => el.getImpl())
31 .then((impl) => impl.getApi());
32}
33
34describes.realWin('PreactBaseElement', {amp: true}, (env) => {
35 let win, doc, html;

Callers 1

Calls 4

whenDefinedMethod · 0.80
getImplMethod · 0.80
thenMethod · 0.45
getApiMethod · 0.45

Tested by

no test coverage detected