Merge "Update magic words and special page aliases for Arabic and Egyptian Arabic"
[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 *
32 * The list of change is now up to date
33 */
34
35 /* Methods */
36
37 /**
38 * Invalidate the list of changes
39 *
40 * @fires invalidate
41 */
42 mw.rcfilters.dm.ChangesListViewModel.prototype.invalidate = function () {
43 if ( this.valid ) {
44 this.valid = false;
45 this.emit( 'invalidate' );
46 }
47 };
48
49 /**
50 * Update the model with an updated list of changes
51 *
52 * @param {jQuery|string} changesListContent
53 * @param {jQuery} $fieldset
54 */
55 mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset ) {
56 this.valid = true;
57 this.emit( 'update', changesListContent, $fieldset );
58 };
59
60 }( mediaWiki ) );