updated alerting methods
Use both toasts and console.
This commit is contained in:
		
							parent
							
								
									794f75ecb7
								
							
						
					
					
						commit
						6a1ea8eb7d
					
				
					 1 changed files with 30 additions and 10 deletions
				
			
		|  | @ -2,16 +2,36 @@ | ||||||
| Alert management system. | Alert management system. | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| export function confirm_action() { | export default class alerts { | ||||||
|  |   static confirm_action() { | ||||||
|     let user_response = false; |     let user_response = false; | ||||||
| 
 | 
 | ||||||
|     (async () => { |     (async () => { | ||||||
|       // Import the module.
 |       // Import the module.
 | ||||||
|     let reader = await import(chrome.runtime.getURL("gui/scripts/read.js")); |       let reader = (await import(chrome.runtime.getURL("gui/scripts/read.js")))[ | ||||||
|  |         `texts` | ||||||
|  |       ]; | ||||||
| 
 | 
 | ||||||
|       // Get the user response.
 |       // Get the user response.
 | ||||||
|     user_response = confirm(reader.read(`GUI_alert_confirm_action_text`)); |       user_response = confirm( | ||||||
|  |         reader.localized(`GUI_alert_confirm_action_text`), | ||||||
|  |       ); | ||||||
|     })(); |     })(); | ||||||
|     // Return the user response.
 |     // Return the user response.
 | ||||||
|     return user_response; |     return user_response; | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   static log(message) { | ||||||
|  |     console.log(message); | ||||||
|  |     try { | ||||||
|  |       M.toast({ text: message }); | ||||||
|  |     } catch (err) {} | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   static warn(message) { | ||||||
|  |     console.warn(message); | ||||||
|  |     try { | ||||||
|  |       M.toast({ text: message }); | ||||||
|  |     } catch (err) {} | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue