MCPcopy Index your code
hub / github.com/angular/angular / delayChangeDetectionForEvents

Function delayChangeDetectionForEvents

packages/core/src/zone/ng_zone.ts:387–424  ·  view source on GitHub ↗
(zone: NgZonePrivate)

Source from the content-addressed store, hash-verified

385}
386
387function delayChangeDetectionForEvents(zone: NgZonePrivate) {
388 /**
389 * We also need to check _nesting here
390 * Consider the following case with shouldCoalesceRunChangeDetection = true
391 *
392 * ngZone.run(() => {});
393 * ngZone.run(() => {});
394 *
395 * We want the two `ngZone.run()` only trigger one change detection
396 * when shouldCoalesceRunChangeDetection is true.
397 * And because in this case, change detection run in async way(requestAnimationFrame),
398 * so we also need to check the _nesting here to prevent multiple
399 * change detections.
400 */
401 if (zone.isCheckStableRunning || zone.callbackScheduled) {
402 return;
403 }
404 zone.callbackScheduled = true;
405 function scheduleCheckStable() {
406 scheduleCallbackWithRafRace(() => {
407 zone.callbackScheduled = false;
408 updateMicroTaskStatus(zone);
409 zone.isCheckStableRunning = true;
410 checkStable(zone);
411 zone.isCheckStableRunning = false;
412 });
413 }
414 if (zone.scheduleInRootZone) {
415 Zone.root.run(() => {
416 scheduleCheckStable();
417 });
418 } else {
419 zone._outer.run(() => {
420 scheduleCheckStable();
421 });
422 }
423 updateMicroTaskStatus(zone);
424}
425
426function forkInnerZoneWithAngularBehavior(zone: NgZonePrivate) {
427 const delayChangeDetectionForEventsDelegate = () => {

Callers 1

Calls 3

scheduleCheckStableFunction · 0.85
updateMicroTaskStatusFunction · 0.85
runMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…