Merge "Remove some ancient upgrade information from release notes"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.CheckboxInputWidget.js
1 ( function ( mw ) {
2 /**
3 * A widget representing a single toggle filter
4 *
5 * @extends OO.ui.CheckboxInputWidget
6 *
7 * @constructor
8 * @param {Object} config Configuration object
9 */
10 mw.rcfilters.ui.CheckboxInputWidget = function MwRcfiltersUiCheckboxInputWidget( config ) {
11 config = config || {};
12
13 // Parent
14 mw.rcfilters.ui.CheckboxInputWidget.parent.call( this, config );
15
16 // Event
17 this.$input.on( 'change', this.onUserChange.bind( this ) );
18 };
19
20 /* Initialization */
21
22 OO.inheritClass( mw.rcfilters.ui.CheckboxInputWidget, OO.ui.CheckboxInputWidget );
23
24 /* Events */
25
26 /**
27 * @event userChange
28 * @param {boolean} Current state of the checkbox
29 *
30 * The user has checked or unchecked this checkbox
31 */
32
33 /* Methods */
34
35 /**
36 * Respond to checkbox change by a user and emit 'userChange'.
37 */
38 mw.rcfilters.ui.CheckboxInputWidget.prototype.onUserChange = function () {
39 this.emit( 'userChange', this.$input.prop( 'checked' ) );
40 };
41 }( mediaWiki ) );