forked from MapComplete/MapComplete
First usable sidewalks theme
This commit is contained in:
parent
02a1d9696f
commit
ff0ee35ec1
19 changed files with 537 additions and 174 deletions
|
@ -109,6 +109,20 @@ export class UIEventSource<T> {
|
|||
promise?.catch(err => src.setData({error: err}))
|
||||
return src
|
||||
}
|
||||
|
||||
public withEqualityStabilized(comparator: (t:T | undefined, t1:T | undefined) => boolean): UIEventSource<T>{
|
||||
let oldValue = undefined;
|
||||
return this.map(v => {
|
||||
if(v == oldValue){
|
||||
return oldValue
|
||||
}
|
||||
if(comparator(oldValue, v)){
|
||||
return oldValue
|
||||
}
|
||||
oldValue = v;
|
||||
return v;
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a UIEVentSource with a list, returns a new UIEventSource which is only updated if the _contents_ of the list are different.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue