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

Method rootUpdated

src/core/context/values.js:263–284  ·  view source on GitHub ↗

* The callback called by the `ContextNode` to notify values of the context * root changes. It's possible that a context node is connected, disconnected, * or moved to another root. This callback schedules recalculations if * necessary. * * @package

()

Source from the content-addressed store, hash-verified

261 * @package
262 */
263 rootUpdated() {
264 const usedByKey = this.usedByKey_;
265 if (!usedByKey) {
266 return;
267 }
268 if (this.isConnected_()) {
269 // Ping all properties for recalculation when the tree is connected.
270 usedByKey.forEach((used) => {
271 const {prop} = used;
272 this.ping(prop, true);
273 });
274 } else {
275 // On disconnect, only do minimal possible work: disconnect recursive
276 // subscribers to ensure that they are not leaked.
277 usedByKey.forEach((used) => {
278 const {prop} = used;
279 if (isRecursive(prop)) {
280 this.updateParentContextNode_(used, null);
281 }
282 });
283 }
284 }
285
286 /**
287 * Used for `deepScan` scanner to notify the subtree that the specified

Callers 1

updateRootMethod · 0.45

Calls 5

isConnected_Method · 0.95
pingMethod · 0.95
isRecursiveFunction · 0.85
forEachMethod · 0.45

Tested by

no test coverage detected