MCPcopy Index your code
hub / github.com/angular/components / _forEachExpansionKey

Method _forEachExpansionKey

src/cdk/tree/tree.ts:1151–1170  ·  view source on GitHub ↗

Invokes a callback with all node expansion keys.

(callback: (keys: K[]) => void)

Source from the content-addressed store, hash-verified

1149
1150 /** Invokes a callback with all node expansion keys. */
1151 private _forEachExpansionKey(callback: (keys: K[]) => void) {
1152 const toToggle: K[] = [];
1153 const observables: Observable<T[]>[] = [];
1154
1155 this._nodes.value.forEach(node => {
1156 toToggle.push(this._getExpansionKey(node.data));
1157 observables.push(this._getDescendants(node.data));
1158 });
1159
1160 if (observables.length > 0) {
1161 combineLatest(observables)
1162 .pipe(take(1), takeUntil(this._onDestroy))
1163 .subscribe(results => {
1164 results.forEach(inner => inner.forEach(r => toToggle.push(this._getExpansionKey(r))));
1165 callback(toToggle);
1166 });
1167 } else {
1168 callback(toToggle);
1169 }
1170 }
1171
1172 /** Clears the maps we use to store parents, level & aria-sets in. */
1173 private _clearPreviousCache() {

Callers 2

expandAllMethod · 0.95
collapseAllMethod · 0.95

Calls 4

_getExpansionKeyMethod · 0.95
_getDescendantsMethod · 0.95
callbackFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected