forked from MapComplete/MapComplete
		
	Chore: don't try to use localStorage when running from the console
This commit is contained in:
		
							parent
							
								
									84c46b35be
								
							
						
					
					
						commit
						4ff50fd92b
					
				
					 1 changed files with 15 additions and 13 deletions
				
			
		|  | @ -42,6 +42,7 @@ export class LocalStorageSource { | |||
|         } | ||||
|         const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key) | ||||
| 
 | ||||
|         if(!Utils.runningFromConsole){ | ||||
|             source.addCallback((data) => { | ||||
|                 if (data === undefined || data === "" || data === null) { | ||||
|                     localStorage.removeItem(key) | ||||
|  | @ -55,6 +56,7 @@ export class LocalStorageSource { | |||
|                     localStorage.clear() | ||||
|                 } | ||||
|             }) | ||||
|         } | ||||
|         LocalStorageSource._cache[key] = source | ||||
|         return source | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue