mirror of https://github.com/vector-im/riot-web
Convert DefaultSettingsHandler to TS
parent
32844d4624
commit
8097810784
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2017 Travis Ralston
|
Copyright 2017 Travis Ralston
|
||||||
Copyright 2019 New Vector Ltd.
|
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -27,29 +27,27 @@ export default class DefaultSettingsHandler extends SettingsHandler {
|
||||||
* @param {object} defaults The default setting values, keyed by setting name.
|
* @param {object} defaults The default setting values, keyed by setting name.
|
||||||
* @param {object} invertedDefaults The default inverted setting values, keyed by setting name.
|
* @param {object} invertedDefaults The default inverted setting values, keyed by setting name.
|
||||||
*/
|
*/
|
||||||
constructor(defaults, invertedDefaults) {
|
constructor(private defaults: any, private invertedDefaults: any) { // TODO: [TS] Appropriate types
|
||||||
super();
|
super();
|
||||||
this._defaults = defaults;
|
|
||||||
this._invertedDefaults = invertedDefaults;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getValue(settingName, roomId) {
|
public getValue(settingName: string, roomId: string): any {
|
||||||
let value = this._defaults[settingName];
|
let value = this.defaults[settingName];
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
value = this._invertedDefaults[settingName];
|
value = this.invertedDefaults[settingName];
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
setValue(settingName, roomId, newValue) {
|
public async setValue(settingName: string, roomId: string, newValue: any): Promise<void> {
|
||||||
throw new Error("Cannot set values on the default level handler");
|
throw new Error("Cannot set values on the default level handler");
|
||||||
}
|
}
|
||||||
|
|
||||||
canSetValue(settingName, roomId) {
|
public canSetValue(settingName: string, roomId: string) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSupported() {
|
public isSupported(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue