MCPcopy Create free account
hub / github.com/angular/angular / debounceSync

Method debounceSync

packages/forms/signals/src/field/node.ts:435–458  ·  view source on GitHub ↗

* Initiates a debounced sync. * * If a debouncer is configured, the synchronization will occur after the debouncer resolves. If * no debouncer is configured, the synchronization happens immediately. If controlValue is * updated again while a debounce is pending, the previ

()

Source from the content-addressed store, hash-verified

433 * of the new one.
434 */
435 private async debounceSync() {
436 const debouncer = untracked(() => {
437 this.pendingSync()?.abort();
438 return this.nodeState.debouncer();
439 });
440
441 if (debouncer) {
442 const controller = new AbortController();
443 const promise = debouncer(controller.signal);
444 if (promise) {
445 this.pendingSync.set(controller);
446 await promise;
447 if (controller.signal.aborted) {
448 return; // Do not sync if the debounce was aborted.
449 }
450 }
451 }
452
453 if (this.structure.isOrphaned()) {
454 return;
455 }
456
457 this.sync();
458 }
459
460 /**
461 * Creates a new root field node for a new form.

Callers 1

controlValueSignalMethod · 0.95

Calls 4

syncMethod · 0.95
untrackedFunction · 0.90
abortMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected