make query a synchronous function
This commit is contained in:
		
							parent
							
								
									6577df36a0
								
							
						
					
					
						commit
						df68375d7b
					
				
					 1 changed files with 6 additions and 9 deletions
				
			
		|  | @ -29,15 +29,12 @@ export default class Tabs { | ||||||
| 	@param {Object} filters The filters on tab search | 	@param {Object} filters The filters on tab search | ||||||
| 	@param {number} index the tab number to return | 	@param {number} index the tab number to return | ||||||
| 	*/ | 	*/ | ||||||
| 	static async query(filters, index) { | 	static query(filters, index) { | ||||||
| 		filters = ((typeof filters).includes(`obj`) && filters != null) ? filters : { active: true, currentWindow: true}; | 		filters = ((typeof filters).includes(`obj`) && filters != null) ? filters : { active: true, currentWindow: true}; | ||||||
| 		let TABS = {}; | 		return ((chrome.tabs.query(filters)).then((TABS_ALL) => { | ||||||
| 
 | 			return ((index != null) | ||||||
| 		TABS.all = await chrome.tabs.query(filters); | 				? TABS_ALL[Math.abs(parseFloat(index))] | ||||||
| 		TABS.result = (index != null) | 				: TABS_ALL); | ||||||
| 			? TABS.all[Math.abs(parseFloat(index))] | 		})); | ||||||
| 			: TABS.all; |  | ||||||
| 
 |  | ||||||
| 		return (TABS.result); |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue