Convert PushToMatrixClientController to TS
This commit is contained in:
parent
437ccb2421
commit
227b611421
1 changed files with 7 additions and 10 deletions
|
@ -15,23 +15,20 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { MatrixClientPeg } from '../../MatrixClientPeg';
|
import { MatrixClientPeg } from '../../MatrixClientPeg';
|
||||||
|
import { SettingLevel } from "../SettingLevel";
|
||||||
|
import SettingController from "./SettingController";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the value changes, call a setter function on the matrix client with the new value
|
* When the value changes, call a setter function on the matrix client with the new value
|
||||||
*/
|
*/
|
||||||
export default class PushToMatrixClientController {
|
export default class PushToMatrixClientController extends SettingController {
|
||||||
constructor(setter, inverse) {
|
constructor(private setter: Function, private inverse: boolean) {
|
||||||
this._setter = setter;
|
super();
|
||||||
this._inverse = inverse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getValueOverride(level, roomId, calculatedValue, calculatedAtLevel) {
|
public onChange(level: SettingLevel, roomId: string, newValue: any) {
|
||||||
return null; // no override
|
|
||||||
}
|
|
||||||
|
|
||||||
onChange(level, roomId, newValue) {
|
|
||||||
// XXX does this work? This surely isn't necessarily the effective value,
|
// XXX does this work? This surely isn't necessarily the effective value,
|
||||||
// but it's what NotificationsEnabledController does...
|
// but it's what NotificationsEnabledController does...
|
||||||
this._setter.call(MatrixClientPeg.get(), this._inverse ? !newValue : newValue);
|
this.setter.call(MatrixClientPeg.get(), this.inverse ? !newValue : newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue