add installation trigger
This commit is contained in:
		
							parent
							
								
									b6ffdc674e
								
							
						
					
					
						commit
						476f0e8b7e
					
				
					 2 changed files with 39 additions and 2 deletions
				
			
		
							
								
								
									
										36
									
								
								scripts/fc.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								scripts/fc.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | /* fc.js | ||||||
|  | This does not stand for "FamiCom" but instead on Finalization and Completion. This script provides installation run scripts. | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | class fc { | ||||||
|  | 
 | ||||||
|  | 	static hello() { | ||||||
|  | 		chrome.tabs.create({ url: `https://codeberg.org/buzzcode2007/ShopAI/wiki` }, function (tab) {}); | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	static setup() { | ||||||
|  | 		/* Initialize the set-up. | ||||||
|  | 
 | ||||||
|  | 		Returns: the initialization result | ||||||
|  | 		*/ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	static trigger() { | ||||||
|  | 		chrome.runtime.onInstalled.addListener(function (object) { | ||||||
|  | 			if (object.reason == chrome.runtime.OnInstalledReason.INSTALL) { | ||||||
|  | 				fc.hello(); | ||||||
|  | 				fc.setup(); | ||||||
|  | 			} | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	static run() { | ||||||
|  | 		/* main function */ | ||||||
|  | 
 | ||||||
|  | 		fc.trigger(); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | @ -2,3 +2,4 @@ | ||||||
| Shop wisely with AI! | Shop wisely with AI! | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
|  | importScripts('fc.js'); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue