Use less lines
due to the async method import
This commit is contained in:
		
							parent
							
								
									c038ed9812
								
							
						
					
					
						commit
						a621df9b87
					
				
					 1 changed files with 135 additions and 154 deletions
				
			
		|  | @ -2,8 +2,7 @@ | |||
| Manage the local cache. | ||||
| */ | ||||
| 
 | ||||
| export default class secretariat { | ||||
| 	static read(prefname, cloud = false) { | ||||
| export function read(prefname, cloud = false) { | ||||
| 	/* Read all storeed data in the browser cache. | ||||
| 
 | ||||
| 	Parameters: | ||||
|  | @ -31,9 +30,9 @@ export default class secretariat { | |||
| 	} | ||||
| 
 | ||||
| 	return(pref_data); | ||||
| 	}; | ||||
| } | ||||
| 
 | ||||
| 	static specifics(WHERE, domain = window.location.href) { | ||||
| export function specifics(WHERE, domain = window.location.href) { | ||||
| 	/* List the matching rule or memory for a particular domain. | ||||
| 
 | ||||
| 	Parameters: | ||||
|  | @ -96,21 +95,7 @@ export default class secretariat { | |||
| 	return(result); | ||||
| } | ||||
| 
 | ||||
| 	static amend(WHERE, website, datas) { | ||||
| 		/* Update the rules. | ||||
| 
 | ||||
| 		Parameters: | ||||
| 			WHERE: the data set to update | ||||
| 			website: RegEx pattern of the website or the domain | ||||
| 			datas: the data in JSON | ||||
| 		Returns: (boolean) the update status | ||||
| 		*/ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 	}; | ||||
| 
 | ||||
| 	static write(prefname, data) { | ||||
| export function write(prefname, data) { | ||||
| 	/* Write the data on the selected prefname. | ||||
| 
 | ||||
| 	Parameters: | ||||
|  | @ -119,9 +104,22 @@ export default class secretariat { | |||
| 	*/ | ||||
| 
 | ||||
| 
 | ||||
| 	}; | ||||
| } | ||||
| 
 | ||||
| 	static forget(domain) { | ||||
| export function amend(WHERE, SITE, DATA) { | ||||
| 	/* Update the rules. | ||||
| 
 | ||||
| 	Parameters: | ||||
| 		WHERE: the data set to update | ||||
| 		SITE: RegEx pattern of the website or the domain | ||||
| 		DATA: the data in JSON | ||||
| 	Returns: (boolean) the update status | ||||
| 	*/ | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| export function forget(domain) { | ||||
| 	/* Dangerous: Resets all data or a domain's data. | ||||
| 
 | ||||
| 	Parameters: | ||||
|  | @ -133,7 +131,7 @@ export default class secretariat { | |||
| 
 | ||||
| 	(async () => { | ||||
| 		// Import alerts module.
 | ||||
| 			let alerts = await import(chrome.runtime.getURL("gui/scripts/alerts.js")); | ||||
| 		let alerts = await import(chrome.runtime.getURL(`gui/scripts/alerts.js`)); | ||||
| 
 | ||||
| 		// Confirm the action.
 | ||||
| 		let forget_action = alerts.confirm_action(); | ||||
|  | @ -151,20 +149,3 @@ export default class secretariat { | |||
| 
 | ||||
| 	return (forget_action); | ||||
| }; | ||||
| }; | ||||
| 
 | ||||
| export function read(prefname) { | ||||
| 	return(secretariat.read(prefname)); | ||||
| }; | ||||
| 
 | ||||
| export function specifics(WHERE, domain = window.location.href) { | ||||
| 	return(secretariat.specifics(WHERE, domain)); | ||||
| } | ||||
| 
 | ||||
| export function amend(website, rules) { | ||||
| 	return (secretariat.amend(website, rules)); | ||||
| }; | ||||
| 
 | ||||
| export function forget(domain) { | ||||
| 	return (secretariat.forget(domain)); | ||||
| }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue