MCPcopy Create free account
hub / github.com/angular/components / _startTimeout

Method _startTimeout

src/cdk/menu/menu-aim.ts:184–198  ·  view source on GitHub ↗

* Start the delayed toggle handler if one isn't running already. * * The delayed toggle handler executes the `doToggle` callback after some period of time iff the * users mouse is on an item in the current menu. * * @param doToggle the function called when the user is not moving towar

(doToggle: () => void)

Source from the content-addressed store, hash-verified

182 * @param doToggle the function called when the user is not moving towards the submenu.
183 */
184 private _startTimeout(doToggle: () => void) {
185 // If the users mouse is moving towards a submenu we don't want to immediately resolve.
186 // Wait for some period of time before determining if the previous menu should close in
187 // cases where the user may have moved towards the submenu but stopped on a sibling menu
188 // item intentionally.
189 const timeoutId = setTimeout(() => {
190 // Resolve if the user is currently moused over some element in the root menu
191 if (this._pointerTracker!.activeElement && timeoutId === this._timeoutId) {
192 doToggle();
193 }
194 this._timeoutId = null;
195 }, CLOSE_DELAY) as any as number;
196
197 this._timeoutId = timeoutId;
198 }
199
200 /** Whether the user is heading towards the open submenu. */
201 private _isMovingToSubmenu() {

Callers 1

toggleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected