Merge "jquery.tablesorter: Silence an expected "sort-rowspan-error" warning"
[mediawiki.git] / resources / src / mediawiki.special.apisandbox / BooleanToggleSwitchParamWidget.js
blob7fa12c406608c61f36796d75220c8c7bc666d6cd
1 const UtilMixin = require( './UtilMixin.js' );
3 /**
4 * A wrapper for OO.ui.ToggleSwitchWidget
6 * @class
7 * @private
8 * @constructor
9 */
10 function BooleanToggleSwitchParamWidget() {
11 BooleanToggleSwitchParamWidget.super.call( this );
14 OO.inheritClass( BooleanToggleSwitchParamWidget, OO.ui.ToggleSwitchWidget );
15 OO.mixinClass( BooleanToggleSwitchParamWidget, UtilMixin );
17 /**
18 * @return {number|undefined}
20 BooleanToggleSwitchParamWidget.prototype.getApiValue = function () {
21 return this.getValue() ? 1 : undefined;
24 /**
25 * @param {any} newValue
27 BooleanToggleSwitchParamWidget.prototype.setApiValue = function ( newValue ) {
28 this.setValue( this.apiBool( newValue ) );
31 /**
32 * @return {jQuery.Promise}
34 BooleanToggleSwitchParamWidget.prototype.apiCheckValid = function () {
35 return $.Deferred().resolve( true ).promise();
38 module.exports = BooleanToggleSwitchParamWidget;