forked from MapComplete/MapComplete
Add UI flow to generate flyers
This commit is contained in:
parent
bc86db2815
commit
9c961d32b3
10 changed files with 814 additions and 624 deletions
|
@ -678,6 +678,18 @@ export class UIEventSource<T> extends Store<T> {
|
|||
public map<J>(f: (t: T) => J, extraSources: Store<any>[] = []): Store<J> {
|
||||
return new MappedStore(this, f, extraSources, this._callbacks, f(this.data))
|
||||
}
|
||||
/**
|
||||
* Monoidal map which results in a read-only store. 'undefined' is passed 'as is'
|
||||
* Given a function 'f', will construct a new UIEventSource where the contents will always be "f(this.data)'
|
||||
*/
|
||||
public mapD<J>(f: (t: T) => J, extraSources: Store<any>[] = []): Store<J | undefined> {
|
||||
return new MappedStore(this, t => {
|
||||
if(t === undefined){
|
||||
return undefined
|
||||
}
|
||||
return f(t)
|
||||
}, extraSources, this._callbacks, this.data === undefined ? undefined : f(this.data))
|
||||
}
|
||||
|
||||
/**
|
||||
* Two way sync with functions in both directions
|
||||
|
|
|
@ -108,4 +108,11 @@ export class QueryParameters {
|
|||
history.replaceState(null, "", "?" + parts.join("&") + Hash.Current())
|
||||
}
|
||||
}
|
||||
|
||||
static ClearAll() {
|
||||
for (const name in QueryParameters.knownSources) {
|
||||
QueryParameters.knownSources[name].setData("")
|
||||
}
|
||||
QueryParameters._wasInitialized.clear()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue