* Removes all items from the map. * @returns {Array. } The previous items
()
| 621 | * @returns {Array.<Host>} The previous items |
| 622 | */ |
| 623 | clear() { |
| 624 | const previousItems = this.values(); |
| 625 | |
| 626 | // Clear cache |
| 627 | this._values = null; |
| 628 | |
| 629 | // Clear items |
| 630 | this._items = new Map(); |
| 631 | |
| 632 | // Emit events |
| 633 | previousItems.forEach(h => this.emit('remove', h)); |
| 634 | |
| 635 | return previousItems; |
| 636 | } |
| 637 | |
| 638 | inspect() { |
| 639 | return this._items; |
no test coverage detected