accomodate PATH being set as a dictionary of options instead
This commit is contained in:
		
							parent
							
								
									891de959db
								
							
						
					
					
						commit
						9d5df38baa
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -11,16 +11,16 @@ export default class Sidebar { | ||||||
| 	*/ | 	*/ | ||||||
| 	constructor (PATH) { | 	constructor (PATH) { | ||||||
| 		// Set side panel's URL. 
 | 		// Set side panel's URL. 
 | ||||||
| 		chrome.sidePanel.setOptions({ path: PATH }); | 		chrome.sidePanel.setOptions(((typeof PATH).includes(`str`)) ? { path: PATH } : PATH); | ||||||
| 		 | 		 | ||||||
| 		// Grab the current tab ID. 
 | 		// Grab the current tab ID. 
 | ||||||
| 		Tabs.query({ active: true, currentWindow: true }, 0).then((TAB) => { | 		Tabs.query({ active: true, currentWindow: true }, 0).then((TAB) => { | ||||||
| 			chrome.sidePanel.open({windowId: TAB.id}); | 			chrome.sidePanel.open({windowId: TAB.id}); | ||||||
| 			this.root = PATH; | 			this.root = ((typeof PATH).includes(`str`)) ? PATH : chrome.sidePanel.getOptions(TAB.id).path; | ||||||
| 		}); | 		}); | ||||||
| 
 | 
 | ||||||
| 		chrome.runtime.onConnect.addListener((CONNECTION) => { | 		chrome.runtime.onConnect.addListener((CONNECTION) => { | ||||||
| 			if ((CONNECTION.name).includes(`view=${PATH}`)) { | 			if ((CONNECTION.name).includes(`view=${this.root}`)) { | ||||||
| 				this.focus(TRUE); | 				this.focus(TRUE); | ||||||
| 				CONNECTION.onDisconnect.addListener(async () => { | 				CONNECTION.onDisconnect.addListener(async () => { | ||||||
| 					this.focus(FALSE); | 					this.focus(FALSE); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue