mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	client-ts: Port services/app/services/spaced_update
This commit is contained in:
		
							parent
							
								
									411234dd9c
								
							
						
					
					
						commit
						6c7a272edc
					
				| @ -1,5 +1,13 @@ | |||||||
|  | type Callback = () => Promise<void>; | ||||||
|  | 
 | ||||||
| export default class SpacedUpdate { | export default class SpacedUpdate { | ||||||
|     constructor(updater, updateInterval = 1000) { |     private updater: Callback; | ||||||
|  |     private lastUpdated: number; | ||||||
|  |     private changed: boolean; | ||||||
|  |     private updateInterval: number; | ||||||
|  |     private changeForbidden?: boolean; | ||||||
|  | 
 | ||||||
|  |     constructor(updater: Callback, updateInterval = 1000) { | ||||||
|         this.updater = updater; |         this.updater = updater; | ||||||
|         this.lastUpdated = Date.now(); |         this.lastUpdated = Date.now(); | ||||||
|         this.changed = false; |         this.changed = false; | ||||||
| @ -52,7 +60,7 @@ export default class SpacedUpdate { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async allowUpdateWithoutChange(callback) { |     async allowUpdateWithoutChange(callback: Callback) { | ||||||
|         this.changeForbidden = true; |         this.changeForbidden = true; | ||||||
| 
 | 
 | ||||||
|         try { |         try { | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran