forked from MapComplete/MapComplete
		
	Way to much fixes and improvements
This commit is contained in:
		
							parent
							
								
									e68d9d99a5
								
							
						
					
					
						commit
						5ed0bb431c
					
				
					 41 changed files with 1244 additions and 402 deletions
				
			
		|  | @ -36,9 +36,8 @@ export class UIEventSource<T>{ | |||
|         }); | ||||
| 
 | ||||
|         for (const possibleSource of possibleSources) { | ||||
|             possibleSource.addCallback(() => { | ||||
|             possibleSource?.addCallback(() => { | ||||
|                 sink.setData(source.data?.data); | ||||
|                  | ||||
|             }) | ||||
|         } | ||||
|          | ||||
|  | @ -86,5 +85,25 @@ export class UIEventSource<T>{ | |||
|         } | ||||
|         return this; | ||||
|     } | ||||
|      | ||||
|     public stabilized(millisToStabilize) : UIEventSource<T>{ | ||||
|          | ||||
|         const newSource = new UIEventSource<T>(this.data); | ||||
|          | ||||
|         let currentCallback = 0; | ||||
|         this.addCallback(latestData => { | ||||
|             currentCallback++; | ||||
|             const thisCallback = currentCallback; | ||||
|             window.setTimeout(() => { | ||||
|                 if(thisCallback === currentCallback){ | ||||
|                     newSource.setData(latestData); | ||||
|                 } | ||||
|             }, millisToStabilize) | ||||
|         }); | ||||
|          | ||||
|         return newSource; | ||||
|          | ||||
|          | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue