Merge "statsd: Rename MediawikiStatsdDataFactory to IBufferingStatsdDataFactory"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / dm / mw.rcfilters.dm.ChangesListViewModel.js
1 ( function ( mw ) {
2 /**
3 * View model for the changes list
4 *
5 * @mixins OO.EventEmitter
6 *
7 * @constructor
8 */
9 mw.rcfilters.dm.ChangesListViewModel = function MwRcfiltersDmChangesListViewModel() {
10 // Mixin constructor
11 OO.EventEmitter.call( this );
12
13 this.valid = true;
14 };
15
16 /* Initialization */
17 OO.initClass( mw.rcfilters.dm.ChangesListViewModel );
18 OO.mixinClass( mw.rcfilters.dm.ChangesListViewModel, OO.EventEmitter );
19
20 /* Events */
21
22 /**
23 * @event invalidate
24 *
25 * The list of changes is now invalid (out of date)
26 */
27
28 /**
29 * @event update
30 * @param {jQuery|string} changesListContent
31 * @param {jQuery} $fieldset
32 *
33 * The list of change is now up to date
34 */
35
36 /* Methods */
37
38 /**
39 * Invalidate the list of changes
40 *
41 * @fires invalidate
42 */
43 mw.rcfilters.dm.ChangesListViewModel.prototype.invalidate = function () {
44 if ( this.valid ) {
45 this.valid = false;
46 this.emit( 'invalidate' );
47 }
48 };
49
50 /**
51 * Update the model with an updated list of changes
52 *
53 * @param {jQuery|string} changesListContent
54 * @param {jQuery} $fieldset
55 */
56 mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset ) {
57 this.valid = true;
58 this.emit( 'update', changesListContent, $fieldset );
59 };
60
61 }( mediaWiki ) );