directly set the product's state
This commit is contained in:
		
							parent
							
								
									f7d5ccecb8
								
							
						
					
					
						commit
						0ff26c8bea
					
				
					 1 changed files with 2 additions and 13 deletions
				
			
		
							
								
								
									
										15
									
								
								scripts/external/processor.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								scripts/external/processor.js
									
										
									
									
										vendored
									
									
								
							|  | @ -4,10 +4,8 @@ Process the information on the website and display it on screen. | ||||||
| 
 | 
 | ||||||
| import scraper from "/scripts/external/scraper.js"; | import scraper from "/scripts/external/scraper.js"; | ||||||
| import product from "/scripts/data/product.js"; | import product from "/scripts/data/product.js"; | ||||||
| import injection from "/scripts/GUI/entrypoints/inject.js" |  | ||||||
| import {global} from "/scripts/secretariat.js"; | import {global} from "/scripts/secretariat.js"; | ||||||
| import logging from "/scripts/logging.js"; | import logging from "/scripts/logging.js"; | ||||||
| import pointer from "/scripts/data/pointer.js"; |  | ||||||
| 
 | 
 | ||||||
| export default class processor { | export default class processor { | ||||||
| 	#filter;  | 	#filter;  | ||||||
|  | @ -23,11 +21,11 @@ export default class processor { | ||||||
| 			await this.product.analyze(); | 			await this.product.analyze(); | ||||||
| 		} catch(err) { | 		} catch(err) { | ||||||
| 			logging.error(err.name, err.message, err.stack, false); | 			logging.error(err.name, err.message, err.stack, false); | ||||||
| 			this.notify({"error": true}); | 			this.product.status[`error`] = true; | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		// Indicate that the process is done. 
 | 		// Indicate that the process is done. 
 | ||||||
| 		await this.notify({"done": true}); | 		this.product.status[`done`] = true; | ||||||
| 
 | 
 | ||||||
| 		// Save the data. 
 | 		// Save the data. 
 | ||||||
| 		this.product.save(); | 		this.product.save(); | ||||||
|  | @ -51,13 +49,4 @@ export default class processor { | ||||||
| 			this.analyze(); | 			this.analyze(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	/* |  | ||||||
| 	Use the storage data to notify about the processing updates.  |  | ||||||
| 	*/ |  | ||||||
| 	async notify (state) { |  | ||||||
| 		// Indicate that this is the last updated. 
 |  | ||||||
| 		await pointer.select(this.URL); |  | ||||||
| 		pointer.update(state); |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue