mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-11-04 13:35:46 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			426 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			426 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) {
 | 
						|
    setTimeout(() => {
 | 
						|
        window.localStorage.setItem("settings", JSON.stringify(d));
 | 
						|
    }, 500);
 | 
						|
}
 |