Extracted switching to existing tab
This commit is contained in:
		| @@ -94,16 +94,20 @@ function removeTab(id : number) { | ||||
|         return | ||||
|  | ||||
|     let indexToRemove = findIndexWithID(id); | ||||
|      | ||||
|     switchToExistingTab(indexToRemove) | ||||
|      | ||||
|     tabs.value.splice(indexToRemove, 1); | ||||
|      | ||||
| } | ||||
|  | ||||
| function switchToExistingTab(indexToRemove: number) { | ||||
|     let activeIndex = findIndexWithID(activeTabId.value); | ||||
|  | ||||
|     if (indexToRemove == activeIndex && activeIndex == 0) | ||||
|         changeActiveTab(tabs.value.at(1)!.id) | ||||
|     else if (indexToRemove == activeIndex) | ||||
|         changeActiveTab(tabs.value.at(0)!.id) | ||||
|          | ||||
|      | ||||
|     tabs.value.splice(indexToRemove, 1); | ||||
|      | ||||
| } | ||||
|  | ||||
| function findIndexWithID(id : number) : number { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user