* Pop items off of the stack up to but excluding `lastItem` and emit each on the close * observable. If the stack is empty or `lastItem` is not on the stack it does nothing. * @param lastItem the element which should be left on the stack * @return whether or not an item was removed from the
(lastItem: MenuStackItem)
| 147 | * @return whether or not an item was removed from the stack |
| 148 | */ |
| 149 | closeSubMenuOf(lastItem: MenuStackItem) { |
| 150 | let removed = false; |
| 151 | if (this._elements.indexOf(lastItem) >= 0) { |
| 152 | removed = this.peek() !== lastItem; |
| 153 | while (this.peek() !== lastItem) { |
| 154 | this._close.next({item: this._elements.pop()!}); |
| 155 | } |
| 156 | } |
| 157 | return removed; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Pop off all MenuStackItems and emit each one on the `close` observable one by one. |
no test coverage detected