Debian Codegraph @

resources/src/mediawiki.special.apisandbox/BooleanToggleSwitchParamWidget.js

raw symbols SCIP
1 const UtilMixin = require( './UtilMixin.js' );
2
3 /**
4 * A wrapper for OO.ui.ToggleSwitchWidget
5 *
6 * @class
7 * @private
8 * @constructor
9 */
10 function BooleanToggleSwitchParamWidget() {
11 BooleanToggleSwitchParamWidget.super.call( this );
12 }
13
14 OO.inheritClass( BooleanToggleSwitchParamWidget, OO.ui.ToggleSwitchWidget );
15 OO.mixinClass( BooleanToggleSwitchParamWidget, UtilMixin );
16
17 /**
18 * @return {number|undefined}
19 */
20 BooleanToggleSwitchParamWidget.prototype.getApiValue = function () {
21 return this.getValue() ? 1 : undefined;
22 };
23
24 /**
25 * @param {any} newValue
26 */
27 BooleanToggleSwitchParamWidget.prototype.setApiValue = function ( newValue ) {
28 this.setValue( this.apiBool( newValue ) );
29 };
30
31 /**
32 * @return {jQuery.Promise}
33 */
34 BooleanToggleSwitchParamWidget.prototype.apiCheckValid = function () {
35 return $.Deferred().resolve( true ).promise();
36 };
37
38 module.exports = BooleanToggleSwitchParamWidget;