Add UI flow to generate flyers

This commit is contained in:
Pieter Vander Vennet 2022-09-17 03:24:01 +02:00
parent bc86db2815
commit 9c961d32b3
10 changed files with 814 additions and 624 deletions

View file

@ -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

View file

@ -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()
}
}