Add @constructor to all Function classes

Change-Id: I67b90a91b57fbd66363551eafe0cdfc14d5f68e8
This commit is contained in:
Tao Zhou
2020-01-09 14:51:25 +01:00
parent a1976465f0
commit 6226dd44c6
24 changed files with 33 additions and 5 deletions

View File

@@ -23,11 +23,11 @@
* Construct a change comments object, which can be data-bound to child * Construct a change comments object, which can be data-bound to child
* elements of that which uses the gr-comment-api. * elements of that which uses the gr-comment-api.
* *
* @constructor
* @param {!Object} comments * @param {!Object} comments
* @param {!Object} robotComments * @param {!Object} robotComments
* @param {!Object} drafts * @param {!Object} drafts
* @param {number} changeNum * @param {number} changeNum
* @constructor
*/ */
function ChangeComments(comments, robotComments, drafts, changeNum) { function ChangeComments(comments, robotComments, drafts, changeNum) {
this._comments = comments; this._comments = comments;

View File

@@ -20,6 +20,7 @@
// Prevent redefinition. // Prevent redefinition.
if (window.GrDiffBuilderBinary) { return; } if (window.GrDiffBuilderBinary) { return; }
/** @constructor */
function GrDiffBuilderBinary(diff, prefs, outputEl) { function GrDiffBuilderBinary(diff, prefs, outputEl) {
GrDiffBuilder.call(this, diff, prefs, outputEl); GrDiffBuilder.call(this, diff, prefs, outputEl);
} }

View File

@@ -24,6 +24,7 @@
// arbitrary JavaScript. // arbitrary JavaScript.
const IMAGE_MIME_PATTERN = /^image\/(bmp|gif|x-icon|jpeg|jpg|png|tiff|webp)$/; const IMAGE_MIME_PATTERN = /^image\/(bmp|gif|x-icon|jpeg|jpg|png|tiff|webp)$/;
/** @constructor */
function GrDiffBuilderImage(diff, prefs, outputEl, baseImage, revisionImage) { function GrDiffBuilderImage(diff, prefs, outputEl, baseImage, revisionImage) {
GrDiffBuilderSideBySide.call(this, diff, prefs, outputEl, []); GrDiffBuilderSideBySide.call(this, diff, prefs, outputEl, []);
this._baseImage = baseImage; this._baseImage = baseImage;

View File

@@ -20,6 +20,7 @@
// Prevent redefinition. // Prevent redefinition.
if (window.GrDiffBuilderSideBySide) { return; } if (window.GrDiffBuilderSideBySide) { return; }
/** @constructor */
function GrDiffBuilderSideBySide(diff, prefs, outputEl, layers) { function GrDiffBuilderSideBySide(diff, prefs, outputEl, layers) {
GrDiffBuilder.call(this, diff, prefs, outputEl, layers); GrDiffBuilder.call(this, diff, prefs, outputEl, layers);
} }

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
(function(window, GrDiffLine) { (function(window) {
'use strict'; 'use strict';
// Prevent redefinition. // Prevent redefinition.
@@ -23,6 +23,7 @@
/** /**
* A chunk of the diff that should be rendered together. * A chunk of the diff that should be rendered together.
* *
* @constructor
* @param {!GrDiffGroup.Type} type * @param {!GrDiffGroup.Type} type
* @param {!Array<!GrDiffLine>=} opt_lines * @param {!Array<!GrDiffLine>=} opt_lines
*/ */
@@ -285,4 +286,4 @@
}; };
window.GrDiffGroup = GrDiffGroup; window.GrDiffGroup = GrDiffGroup;
})(window, GrDiffLine); })(window);

View File

@@ -21,6 +21,7 @@
if (window.GrDiffLine) { return; } if (window.GrDiffLine) { return; }
/** /**
* @constructor
* @param {GrDiffLine.Type} type * @param {GrDiffLine.Type} type
* @param {number|string=} opt_beforeLine * @param {number|string=} opt_beforeLine
* @param {number|string=} opt_afterLine * @param {number|string=} opt_afterLine
@@ -46,6 +47,7 @@
this.text = ''; this.text = '';
} }
/** @enum {string} */
GrDiffLine.Type = { GrDiffLine.Type = {
ADD: 'add', ADD: 'add',
BOTH: 'both', BOTH: 'both',

View File

@@ -20,6 +20,7 @@
// Prevent redefinition. // Prevent redefinition.
if (window.GrAdminApi) { return; } if (window.GrAdminApi) { return; }
/** @constructor */
function GrAdminApi(plugin) { function GrAdminApi(plugin) {
this.plugin = plugin; this.plugin = plugin;
plugin.on('admin-menu-links', this); plugin.on('admin-menu-links', this);

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrAttributeHelper(element) { function GrAttributeHelper(element) {
this.element = element; this.element = element;
this._promises = {}; this._promises = {};

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrChangeMetadataApi(plugin) { function GrChangeMetadataApi(plugin) {
this._hook = null; this._hook = null;
this.plugin = plugin; this.plugin = plugin;

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrDomHooksManager(plugin) { function GrDomHooksManager(plugin) {
this._plugin = plugin; this._plugin = plugin;
this._hooks = {}; this._hooks = {};

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrEventHelper(element) { function GrEventHelper(element) {
this.element = element; this.element = element;
this._unsubscribers = []; this._unsubscribers = [];

View File

@@ -23,6 +23,7 @@
* opt_moduleName is a name of custom element that will be automatically * opt_moduleName is a name of custom element that will be automatically
* inserted on popup opening. * inserted on popup opening.
* *
* @constructor
* @param {!Object} plugin * @param {!Object} plugin
* @param {opt_moduleName=} string * @param {opt_moduleName=} string
*/ */

View File

@@ -20,6 +20,7 @@
// Prevent redefinition. // Prevent redefinition.
if (window.GrRepoApi) { return; } if (window.GrRepoApi) { return; }
/** @constructor */
function GrRepoApi(plugin) { function GrRepoApi(plugin) {
this._hook = null; this._hook = null;
this.plugin = plugin; this.plugin = plugin;

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrSettingsApi(plugin) { function GrSettingsApi(plugin) {
this._title = '(no title)'; this._title = '(no title)';
// Generate default screen URL token, specific to plugin, and unique(ish). // Generate default screen URL token, specific to plugin, and unique(ish).

View File

@@ -22,6 +22,7 @@
let styleObjectCount = 0; let styleObjectCount = 0;
/** @constructor */
function GrStyleObject(rulesStr) { function GrStyleObject(rulesStr) {
this._rulesStr = rulesStr; this._rulesStr = rulesStr;
this._className = `__pg_js_api_class_${styleObjectCount}`; this._className = `__pg_js_api_class_${styleObjectCount}`;

View File

@@ -20,6 +20,7 @@
// Prevent redefinition. // Prevent redefinition.
if (window.GrThemeApi) { return; } if (window.GrThemeApi) { return; }
/** @constructor */
function GrThemeApi(plugin) { function GrThemeApi(plugin) {
this.plugin = plugin; this.plugin = plugin;
} }

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrAnnotationActionsInterface(plugin) { function GrAnnotationActionsInterface(plugin) {
this.plugin = plugin; this.plugin = plugin;
// Return this instance when there is an annotatediff event. // Return this instance when there is an annotatediff event.
@@ -168,6 +169,7 @@
/** /**
* Used to create an instance of the Annotation Layer interface. * Used to create an instance of the Annotation Layer interface.
* *
* @constructor
* @param {String} path The file path (eg: /COMMIT_MSG'). * @param {String} path The file path (eg: /COMMIT_MSG').
* @param {String} changeNum The Gerrit change number. * @param {String} changeNum The Gerrit change number.
* @param {String} patchNum The Gerrit patch number. * @param {String} patchNum The Gerrit patch number.

View File

@@ -33,6 +33,7 @@
/** /**
* @deprecated * @deprecated
* @constructor
*/ */
function GrChangeReplyInterfaceOld(el) { function GrChangeReplyInterfaceOld(el) {
this._el = el; this._el = el;

View File

@@ -17,6 +17,7 @@
(function(window) { (function(window) {
'use strict'; 'use strict';
/** @constructor */
function GrPluginEndpoints() { function GrPluginEndpoints() {
this._endpoints = {}; this._endpoints = {};
this._callbacks = {}; this._callbacks = {};

View File

@@ -45,13 +45,17 @@
STYLE: 'style', STYLE: 'style',
}; };
/**
* @constructor
* @param {string=} opt_url
*/
function Plugin(opt_url) { function Plugin(opt_url) {
this._domHooks = new GrDomHooksManager(this); this._domHooks = new GrDomHooksManager(this);
if (!opt_url) { if (!opt_url) {
console.warn('Plugin not being loaded from /plugins base path.', console.warn('Plugin not being loaded from /plugins base path.',
'Unable to determine name.'); 'Unable to determine name.');
return; return this;
} }
this.deprecated = { this.deprecated = {
_loadedGwt: deprecatedAPI._loadedGwt.bind(this), _loadedGwt: deprecatedAPI._loadedGwt.bind(this),
@@ -226,7 +230,7 @@
* @example * @example
* const pluginRestApi = plugin.restApi(plugin.url()); * const pluginRestApi = plugin.restApi(plugin.url());
* *
* @param {string} Base url for subsequent .get(), .post() etc requests. * @param {string=} opt_prefix url for subsequent .get(), .post() etc requests.
*/ */
Plugin.prototype.restApi = function(opt_prefix) { Plugin.prototype.restApi = function(opt_prefix) {
return new GrPluginRestApi(opt_prefix); return new GrPluginRestApi(opt_prefix);

View File

@@ -29,6 +29,7 @@
* in the text as well as custom links if any are specified in the linkConfig * in the text as well as custom links if any are specified in the linkConfig
* parameter. * parameter.
* *
* @constructor
* @param {Object|null|undefined} linkConfig Comment links as specified by the * @param {Object|null|undefined} linkConfig Comment links as specified by the
* commentlinks field on a project config. * commentlinks field on a project config.
* @param {Function} callback The callback to be fired when an intermediate * @param {Function} callback The callback to be fired when an intermediate

View File

@@ -23,6 +23,7 @@
// Limit cache size because /change/detail responses may be large. // Limit cache size because /change/detail responses may be large.
const MAX_CACHE_SIZE = 30; const MAX_CACHE_SIZE = 30;
/** @constructor */
function GrEtagDecorator() { function GrEtagDecorator() {
this._etags = new Map(); this._etags = new Map();
this._payloadCache = new Map(); this._payloadCache = new Map();

View File

@@ -20,6 +20,7 @@
// Prevent redefinition. // Prevent redefinition.
if (window.GrReviewerUpdatesParser) { return; } if (window.GrReviewerUpdatesParser) { return; }
/** @constructor */
function GrReviewerUpdatesParser(change) { function GrReviewerUpdatesParser(change) {
this.result = Object.assign({}, change); this.result = Object.assign({}, change);
this._lastState = {}; this._lastState = {};

View File

@@ -20,6 +20,7 @@ limitations under the License.
'use strict'; 'use strict';
/** /**
* @constructor
* @param {Object} change A change object resulting from a change detail * @param {Object} change A change object resulting from a change detail
* call that includes revision information. * call that includes revision information.
*/ */