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

Method updateRoot

src/core/context/node.js:332–348  ·  view source on GitHub ↗

* @param {?ContextNode<?>} root * @protected Used cross-binary.

(root)

Source from the content-addressed store, hash-verified

330 * @protected Used cross-binary.
331 */
332 updateRoot(root) {
333 devAssert(!root || root.isRoot);
334 const oldRoot = this.root;
335 if (root != oldRoot) {
336 // The root has changed.
337 this.root = root;
338
339 // Make sure the tree changes have been reflected for values.
340 this.values.rootUpdated();
341
342 // Make sure the tree changes have been reflected for subscribers.
343 this.subscribers_?.forEach((comp) => comp.rootUpdated());
344
345 // Propagate the root to the subtree.
346 this.children?.forEach((child) => child.updateRoot(root));
347 }
348 }
349
350 /**
351 * @param {string} name

Callers 2

setIsRootMethod · 0.95
updateTree_Method · 0.95

Calls 3

devAssertFunction · 0.90
rootUpdatedMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected