mediawiki-extensions-Revisi.../modules/ext.RevisionSlider.Pointer.js
Thiemo Kreuz 7f38c9c579 Improve discoverability of JS code with @class tags
In my PHPStorm IDE, this makes it possible to follow all methods and
properties in these classes, even these that are later defined.
Otherwise only the empty stub of each class is found.

This might be different in other IDEs.

Basically: PHPStorm does not understand the meaning of the $.extend()
syntax from jQuery without these hints.

Change-Id: I4aa76db183122f6669dc72561441f46f0056d793
2020-01-24 17:21:23 +01:00

65 lines
1 KiB
JavaScript

( function () {
/**
* Module containing logic for the revision pointers
*
* @param {string} name
* @constructor
*/
var Pointer = function ( name ) {
this.view = new mw.libs.revisionSlider.PointerView( this, name );
this.line = new mw.libs.revisionSlider.PointerLine( this, name );
};
/**
* @class mw.libs.revisionSlider.Pointer
*/
$.extend( Pointer.prototype, {
/**
* @type {number}
*/
position: 0,
/**
* @type {PointerView}
*/
view: null,
/**
* @type {PointerLine}
*/
line: null,
/**
* @param {number} p
*/
setPosition: function ( p ) {
this.position = p;
this.getView().setDataPositionAttribute( p );
},
/**
* @return {number}
*/
getPosition: function () {
return this.position;
},
/**
* @return {PointerView}
*/
getView: function () {
return this.view;
},
/**
* @return {PointerLine}
*/
getLine: function () {
return this.line;
}
} );
mw.libs.revisionSlider = mw.libs.revisionSlider || {};
mw.libs.revisionSlider.Pointer = Pointer;
}() );