mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
feat(mobx): add experiments store
This commit is contained in:
@@ -10,7 +10,7 @@ export type Experiment = "dummy" | "theme_shop";
|
||||
/**
|
||||
* Currently active experiments.
|
||||
*/
|
||||
export const AVAILABLE_EXPERIMENTS: Experiment[] = ["theme_shop"];
|
||||
export const AVAILABLE_EXPERIMENTS: Experiment[] = ["dummy", "theme_shop"];
|
||||
|
||||
/**
|
||||
* Definitions for experiments listed by {@link Experiment}.
|
||||
@@ -84,6 +84,19 @@ export default class Experiments implements Persistent<Data> {
|
||||
this.enabled.delete(experiment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of an experiment.
|
||||
* @param key Experiment
|
||||
* @param enabled Whether this experiment is enabled.
|
||||
*/
|
||||
@computed setEnabled(key: Experiment, enabled: boolean): void {
|
||||
if (enabled) {
|
||||
this.enable(key);
|
||||
} else {
|
||||
this.disable(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset and disable all experiments.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user