Allow the creation and removal of action events related to the popup
This commit is contained in:
		
							parent
							
								
									b5a35682fc
								
							
						
					
					
						commit
						6971f2fb3c
					
				
					 1 changed files with 34 additions and 0 deletions
				
			
		|  | @ -37,6 +37,40 @@ class BrowserIcon { | ||||||
| 
 | 
 | ||||||
| 		return (chrome.action[`get`.concat(detail)](((parameters) ? format(parameters) : null))); | 		return (chrome.action[`get`.concat(detail)](((parameters) ? format(parameters) : null))); | ||||||
| 	} | 	} | ||||||
|  | 	 | ||||||
|  | 	/* | ||||||
|  | 	Add an action listener to the browser icon.  | ||||||
|  | 	 | ||||||
|  | 	@param {string} event the event name | ||||||
|  | 	@param {function} callback the function to be run | ||||||
|  | 	*/ | ||||||
|  | 	static addActionListener(event, callback) { | ||||||
|  | 		chrome.browserAction[event].addListener(callback);  | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	/* | ||||||
|  | 	Remove an action listener to the browser icon.  | ||||||
|  | 	 | ||||||
|  | 	@param {string} event the event name | ||||||
|  | 	@param {function} callback the function to be removed | ||||||
|  | 	*/ | ||||||
|  | 	static removeActionListener(event, callback) { | ||||||
|  | 		chrome.browserAction[event].removeListener(callback);  | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	/* | ||||||
|  | 	Enable the action event.  | ||||||
|  | 	*/ | ||||||
|  | 	static enable() { | ||||||
|  | 		chrome.action.enable(); | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | 	/* | ||||||
|  | 	Disable the action event.  | ||||||
|  | 	*/ | ||||||
|  | 	static disable() { | ||||||
|  | 		chrome.action.disable(); | ||||||
|  | 	}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export {BrowserIcon as default}; | export {BrowserIcon as default}; | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue