3 * Widget for toggling live updates
5 * @extends OO.ui.ToggleButtonWidget
8 * @param {mw.rcfilters.Controller} controller
9 * @param {Object} config Configuration object
11 mw
.rcfilters
.ui
.LiveUpdateButtonWidget
= function MwRcfiltersUiLiveUpdateButtonWidget( controller
, config
) {
12 config
= config
|| {};
15 mw
.rcfilters
.ui
.LiveUpdateButtonWidget
.parent
.call( this, $.extend( {
17 label
: mw
.message( 'rcfilters-liveupdates-button' ).text()
20 this.controller
= controller
;
23 this.connect( this, { change
: 'onChange' } );
25 this.$element
.addClass( 'mw-rcfilters-ui-liveUpdateButtonWidget' );
30 OO
.inheritClass( mw
.rcfilters
.ui
.LiveUpdateButtonWidget
, OO
.ui
.ToggleButtonWidget
);
35 * Respond to the button being toggled.
36 * @param {boolean} enable Whether the button is now pressed/enabled
38 mw
.rcfilters
.ui
.LiveUpdateButtonWidget
.prototype.onChange = function ( enable
) {
39 this.controller
.toggleLiveUpdate( enable
);