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

Method make

src/core/data-structures/dom-based-weakref.js:28–37  ·  view source on GitHub ↗

* Returns a WeakRef. Uses this implementation if the real WeakRef class * is not available. * @param {Window} win * @param {Element} element * @return {WeakRef |DomBasedWeakRef}

(win, element)

Source from the content-addressed store, hash-verified

26 * @return {WeakRef<Element>|DomBasedWeakRef}
27 */
28 static make(win, element) {
29 if (win.WeakRef) {
30 return new win.WeakRef(element);
31 }
32 if (!element.id) {
33 const index = (win.__AMP_WEAKREF_ID = (win.__AMP_WEAKREF_ID || 0) + 1);
34 element.id = 'weakref-id-' + index;
35 }
36 return new DomBasedWeakRef(win, element.id);
37 }
38
39 /** @return {Element|undefined} */
40 deref() {

Callers 6

manageMethod · 0.80
renderCountMethod · 0.80
renderTemplateMethod · 0.80
renderPinMethod · 0.80
renderTemplateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected