1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Switch to using stable values for Threads (#2228)

This commit is contained in:
Germain
2022-03-11 09:04:17 +00:00
committed by GitHub
parent e16e7bc098
commit 9058dbf289
20 changed files with 138 additions and 124 deletions

View File

@@ -70,6 +70,22 @@ export class NamespacedValue<S extends string, U extends string> {
}
}
export class ServerControlledNamespacedValue<S extends string, U extends string>
extends NamespacedValue<S, U> {
private preferUnstable = false;
public setPreferUnstable(preferUnstable: boolean): void {
this.preferUnstable = preferUnstable;
}
public get name(): U | S {
if (this.stable && !this.preferUnstable) {
return this.stable;
}
return this.unstable;
}
}
/**
* Represents a namespaced value which prioritizes the unstable value over the stable
* value.