mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-11-01 02:43:35 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			427 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			427 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const settings = JSON.parse(window.localStorage.getItem("settings")) || {};
 | |
| 
 | |
| export function settings_get(key) {
 | |
|     if (settings[key] === undefined) {
 | |
|         return null;
 | |
|     }
 | |
|     return settings[key];
 | |
| }
 | |
| 
 | |
| export function settings_put(key, value) {
 | |
|     settings[key] = value;
 | |
|     save(settings);
 | |
| }
 | |
| 
 | |
| function save(d) {
 | |
|     setInterval(() => {
 | |
|         window.localStorage.setItem("settings", JSON.stringify(d));
 | |
|     }, 500);
 | |
| }
 | 
