forked from MapComplete/MapComplete
		
	Chore: inline some 'self'-variables
This commit is contained in:
		
							parent
							
								
									acb651b96f
								
							
						
					
					
						commit
						91a7957b85
					
				
					 1 changed files with 4 additions and 7 deletions
				
			
		|  | @ -1,6 +1,5 @@ | |||
| import { Utils } from "../Utils" | ||||
| import { Readable, Subscriber, Unsubscriber, Updater, Writable } from "svelte/store" | ||||
| 
 | ||||
| /** | ||||
|  * Various static utils | ||||
|  */ | ||||
|  | @ -952,15 +951,14 @@ export class UIEventSource<T> extends Store<T> implements Writable<T> { | |||
|         g: (j: J, t: T) => T, | ||||
|         allowUnregister = false | ||||
|     ): UIEventSource<J> { | ||||
|         const self = this | ||||
| 
 | ||||
|         const stack = new Error().stack.split("\n") | ||||
|         const callee = stack[1] | ||||
| 
 | ||||
|         const newSource = new UIEventSource<J>(f(this.data), "map(" + this.tag + ")@" + callee) | ||||
| 
 | ||||
|         const update = function () { | ||||
|             newSource.setData(f(self.data)) | ||||
|         const update =() => { | ||||
|             newSource.setData(f(this.data)) | ||||
|             return allowUnregister && newSource._callbacks.length() === 0 | ||||
|         } | ||||
| 
 | ||||
|  | @ -971,7 +969,7 @@ export class UIEventSource<T> extends Store<T> implements Writable<T> { | |||
| 
 | ||||
|         if (g !== undefined) { | ||||
|             newSource.addCallback((latest) => { | ||||
|                 self.setData(g(latest, self.data)) | ||||
|                 this.setData(g(latest, this.data)) | ||||
|             }) | ||||
|         } | ||||
| 
 | ||||
|  | @ -980,8 +978,7 @@ export class UIEventSource<T> extends Store<T> implements Writable<T> { | |||
| 
 | ||||
|     public syncWith(otherSource: UIEventSource<T>, reverseOverride = false): UIEventSource<T> { | ||||
|         this.addCallback((latest) => otherSource.setData(latest)) | ||||
|         const self = this | ||||
|         otherSource.addCallback((latest) => self.setData(latest)) | ||||
|         otherSource.addCallback((latest) => this.setData(latest)) | ||||
|         if (reverseOverride) { | ||||
|             if (otherSource.data !== undefined) { | ||||
|                 this.setData(otherSource.data) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue