add pop-up manager, replacing the sidebar
This commit is contained in:
		
							parent
							
								
									24ea042d32
								
							
						
					
					
						commit
						601a17043d
					
				
					 2 changed files with 27 additions and 21 deletions
				
			
		
							
								
								
									
										27
									
								
								scripts/GUI/entrypoints/popup.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								scripts/GUI/entrypoints/popup.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| import Popup from "/scripts/GUI/popup.js"; | ||||
| 
 | ||||
| export default class ManagedPopup { | ||||
| 	constructor () { | ||||
| 		this.instance = new Popup({"popup": "/pages/popup.htm", "hidden": true}); | ||||
| 		this.listener = chrome.runtime.onMessage.addListener( | ||||
| 			(request, sender, sendResponse) => { | ||||
| 				(request.action == "popup_open") ? this.enable() : this.disable(); | ||||
| 			} | ||||
| 		); | ||||
| 	} | ||||
| 	 | ||||
| 	/* | ||||
| 	Enable the popup.  | ||||
| 	*/ | ||||
| 	enable() { | ||||
| 		this.instance.enable(); | ||||
| 	} | ||||
| 
 | ||||
| 	/*  | ||||
| 	Close and disable the popup.  | ||||
| 	*/ | ||||
| 	disable() { | ||||
| 		// Close the sidebar. 
 | ||||
| 		this.instance.disable(); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,21 +0,0 @@ | |||
| import Sidebar from '/scripts/GUI/sidepanel.js' | ||||
| 
 | ||||
| export default class ManagedSidebar { | ||||
| 	static manage() { | ||||
| 		chrome.runtime.onMessage.addListener( | ||||
| 			function(request, sender, sendResponse) { | ||||
| 				if (request.action == "sidebar_open") { | ||||
| 					ManagedSidebar.enable(); | ||||
| 				} | ||||
| 			} | ||||
| 		); | ||||
| 	} | ||||
| 	 | ||||
| 	static enable() { | ||||
| 		new Sidebar(`/pages/popup.htm`); | ||||
| 	} | ||||
| 
 | ||||
| 	disable() { | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue