* Calls the `doToggle` callback when it is deemed that the user is not moving towards * the submenu. * @param doToggle the function called when the user is not moving towards the submenu.
(doToggle: () => void)
| 151 | * @param doToggle the function called when the user is not moving towards the submenu. |
| 152 | */ |
| 153 | toggle(doToggle: () => void) { |
| 154 | // If the menu is horizontal the sub-menus open below and there is no risk of premature |
| 155 | // closing of any sub-menus therefore we automatically resolve the callback. |
| 156 | if (this._menu.orientation === 'horizontal') { |
| 157 | doToggle(); |
| 158 | } |
| 159 | |
| 160 | this._checkConfigured(); |
| 161 | |
| 162 | const siblingItemIsWaiting = !!this._timeoutId; |
| 163 | const hasPoints = this._points.length > 1; |
| 164 | |
| 165 | if (hasPoints && !siblingItemIsWaiting) { |
| 166 | if (this._isMovingToSubmenu()) { |
| 167 | this._startTimeout(doToggle); |
| 168 | } else { |
| 169 | doToggle(); |
| 170 | } |
| 171 | } else if (!siblingItemIsWaiting) { |
| 172 | doToggle(); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Start the delayed toggle handler if one isn't running already. |
nothing calls this directly
no test coverage detected