chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-04-15 18:18:44 +02:00
parent 79b6927b56
commit 42ded4c1b1
328 changed files with 4062 additions and 1284 deletions

View file

@ -246,13 +246,20 @@ export class OsmConnection {
}
public getPreference<T extends string = string>(
key: string, options?: {
defaultValue?: string,
prefix?: "mapcomplete-" | string,
key: string,
options?: {
defaultValue?: string
prefix?: "mapcomplete-" | string
saveToLocalStorage?: true | boolean
}
): UIEventSource<T | undefined> {
return <UIEventSource<T>>this.preferencesHandler.getPreference(key, options?.defaultValue, options?.prefix ?? "mapcomplete-")
return <UIEventSource<T>>(
this.preferencesHandler.getPreference(
key,
options?.defaultValue,
options?.prefix ?? "mapcomplete-"
)
)
}
public LogOut() {
@ -735,10 +742,8 @@ export class OsmConnection {
}
public getCurrentChangesetFor(theme: string) {
return UIEventSource.asObject<{ id: number, opened: number }>(
this.GetPreference(
"current-changeset-" + theme
),
return UIEventSource.asObject<{ id: number; opened: number }>(
this.GetPreference("current-changeset-" + theme),
undefined
)
}
@ -748,9 +753,10 @@ export class OsmConnection {
*/
public getAllOpenChangesetsPreferences(): Store<string[]> {
const prefix = "current-changeset-"
return this.preferencesHandler.allPreferences.map(dict =>
return this.preferencesHandler.allPreferences.map((dict) =>
Object.keys(dict)
.filter(k => k.startsWith(prefix))
.map(k => k.substring(prefix.length)))
.filter((k) => k.startsWith(prefix))
.map((k) => k.substring(prefix.length))
)
}
}